<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class StoreBonusRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'max:255'],
            'amount_type' => ['required', 'in:fixed,percentage'],
            'amount' => ['required', 'numeric', 'min:0'],
            'eligibility_type' => ['nullable', 'array'],
            'eligibility_type.department_ids' => ['nullable', 'array'],
            'eligibility_type.department_ids.*' => ['exists:departments,id'],
            'eligibility_type.gender' => ['nullable', 'array'],
            'eligibility_type.min_service_months' => ['nullable', 'integer', 'min:0'],
        ];
    }
}
