<?php

namespace Modules\Employee\Http\Requests\EmploymentStatus;

use Illuminate\Foundation\Http\FormRequest;
use Modules\Core\Enums\StatusEnum;
use Modules\Core\Traits\FailedValidation;

class StoreEmploymentStatusRequest extends FormRequest
{
    use FailedValidation;
    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'name' => [
                'required',
                'string',
                'max:255',
                'unique:employment_statuses,name',
            ],

            'status' => [
                'required',
                'string',
                'in:' . implode(',', StatusEnum::casesAsArray()),
            ],
        ];
    }

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