<?php

declare(strict_types=1);

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

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;

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

    /**
     * @return array
     */
    public function rules(): array
    {
        return [
            'nazov' => 'required|min:1|max:255',
            'popis' => 'max:1024',
            'pocet_otazok' => 'required|integer|min:1|max:100',
            'stav' => [
                'required',
                new EnumRule(ModelStatusEnum::class),
            ],
        ];
    }

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