<?php

namespace App\Modules\HR\Departments\Requests;

use App\Modules\HR\Departments\Models\Department;
use Illuminate\Foundation\Http\FormRequest;

class BulkDestroyDepartmentsRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()->can('deleteAny', Department::class);
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'ids' => ['required', 'array', 'min:1'],
            'ids.*' => ['integer', 'distinct', 'exists:departments,id'],
        ];
    }
}
