<?php

declare(strict_types=1);

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

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

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

    /**
     * @return bool
     */
    public function authorize(): bool
    {
        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,
            ],
        ];
    }
}
