<?php

namespace App\Http\Requests;

use App\Models\Informacia\Enums\StavInformacieEnum;
use Illuminate\Foundation\Http\FormRequest;
use Spatie\Enum\Laravel\Http\EnumRequest;
use Spatie\Enum\Laravel\Http\Requests\TransformsEnums;

/**
 *
 */
class InformaciaUpdateRequest extends FormRequest
{
    use TransformsEnums;

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'titulok' => 'required',
            'obsah' => 'nullable|max:4096',
            'stav' => 'required',
            'zverejnit_pre_pouzivatelov_podla_role' => 'array|nullable',
            'planovany_cas_zverejnenia' => 'datetime|nullable|after:now',
            'odoslat_email_pouzivatelom' => 'required|boolean',
            'odoslat_push_notifikacie_pouzivatelom' => 'required|boolean',
            'odporucane' => 'required|boolean',
        ];
    }

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