<?php

namespace App\Http\Requests\Hr;

use Illuminate\Foundation\Http\FormRequest;

class StoreGratuityRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()?->hasPermission('gratuity.manage') === true;
    }

    public function rules(): array
    {
        return [
            'last_working_date' => ['required', 'date'],
            'excluded_days' => ['nullable', 'integer', 'min:0'],
            'work_ratio' => ['nullable', 'numeric', 'min:0.01', 'max:1'],
            'termination_reason' => ['nullable', 'string', 'max:80'],
        ];
    }
}
