<?php

namespace Modules\HR\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Modules\Core\Traits\FailedValidation;
use Modules\HR\Enums\SalaryRevisionStatusEnum;

class UpdateSalaryRevisionStatusRequest extends FormRequest
{
    use FailedValidation;
    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
                'salary_revision_status' => [
                    'required',
                    'string',
                    Rule::in(SalaryRevisionStatusEnum::casesAsArray()),
                ],
            ];
    }

    public function messages(): array
    {
        return [
            'salary_revision_status.required' => 'The status field is required.',
            'salary_revision_status.string' => 'The status must be a string.',
            'salary_revision_status.in' => 'The selected status is invalid. Allowed values are: ' . implode(', ', SalaryRevisionStatusEnum::casesAsArray()) . '.',
        ];
    }

    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }
}
