<?php

namespace Modules\HR\Http\Requests\WeekendPolicy;

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

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

            'weekend_days.*' => [
                'required',
                'string',
                Rule::in(WeekendEnum::casesAsArray()),
            ],
            'is_default' => [
                'boolean',
            ],
            'status' => [
                'required',
                'string',
                Rule::in(StatusEnum::casesAsArray()),
            ],
        ];
    }

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