<?php

namespace App\Http\Requests\TicketType;

use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;

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

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'code'           => 'sometimes|string|max:50|unique:ticket_types,code,' . $this->route('ticket_type'),
            'name'           => 'sometimes|string|max:100',
            'need_approval'  => 'sometimes|boolean',
            'sla_minutes'    => 'nullable|integer'
        ];
    }
}
