<?php

declare(strict_types=1);

namespace Seka\Vzdelavanie\Http\Requests\Sprava\Testovanie\Odpoved;

use Spatie\Enum\Laravel\Rules\EnumRule;
use Spatie\Enum\Laravel\Http\EnumRequest;
use Illuminate\Foundation\Http\FormRequest;
use Seka\Vzdelavanie\Enums\ModelStatusEnum;
use Spatie\Enum\Laravel\Http\Requests\TransformsEnums;
use Seka\Vzdelavanie\Models\Testovanie\HodnotenieOdpovedeEnum;

/**
 * Class OdpovedStoreRequest
 *
 * @package Seka\Vzdelavanie\Http\Requests\Sprava\Testovanie\Odpoved
 */
final class OdpovedStoreRequest extends FormRequest
{
    use TransformsEnums;

    /**
     * @return array
     */
    public function rules(): array
    {
        return [
            'znenie' => 'required|min:10|max:8192',
            'stav' => [
                'required',
                new EnumRule(ModelStatusEnum::class),
            ],
            'hodnotenie' => [
                'required',
                new EnumRule(HodnotenieOdpovedeEnum::class),
            ],
        ];
    }

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