<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class HolidayAssignRequest extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        switch ($this->method()) {
            case 'GET':
            case 'DELETE': {
                    return [];
                }
            case 'POST' || 'PATCH': {
                    return [
                        'department_ids' => ['required', 'array'],
                        'holiday_ids' => ['nullable', 'array'],
                    ];
                }
            default:
                break;
        }
    }

    public function messages()
    {
        return [
            'department_ids.required' =>  _trans('validation.Department is required'),
            'holiday_ids.required' =>  _trans('validation.Holiday is required'),
        ];
    }
}
