<?php

declare(strict_types=1);

namespace Seka\Portal\Modul\Statistiky\Http\Requests;

use Illuminate\Validation\Rule;
use Spatie\Enum\Laravel\Http\EnumRequest;
use Illuminate\Foundation\Http\FormRequest;
use Spatie\Enum\Laravel\Http\Requests\TransformsEnums;
use Seka\Portal\Modul\Statistiky\Http\View\ZaznamDatumFilterEnum;

/**
 * Class ZaznamFilterRequest
 *
 * @package Seka\Portal\Modul\Statistiky\Http\Requests
 */
final class ZaznamFilterRequest extends FormRequest
{
    use TransformsEnums;

    /**
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * @return array
     */
    public function rules(): array
    {
        return [
            'datefilter' => Rule::in(ZaznamDatumFilterEnum::toValues()),
        ];
    }

    /**
     * @return string[]
     */
    public function enums(): array
    {
        return [
            EnumRequest::REQUEST_REQUEST => [
                'datefilter' => ZaznamDatumFilterEnum::class,
            ],
        ];
    }
}
