<?php

namespace App\Modules\HR\EmployeeSelfService\Requests;

use App\Modules\HR\Overtime\Models\OvertimeRequest;
use Illuminate\Foundation\Http\FormRequest;

class MeStoreOvertimeRequestRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()?->can('create', OvertimeRequest::class) ?? false;
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'attendance_date' => ['required', 'date'],
            'overtime_minutes' => ['required', 'integer', 'min:1', 'max:1440'],
            'reason' => ['nullable', 'string', 'max:5000'],
        ];
    }
}
