<?php

namespace App\Http\Requests\Admin;

use App\Models\TicketPredefinedReply;
use Illuminate\Foundation\Http\FormRequest;

class TicketPredefinedReplySearchRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return $this->user()->can('viewAny', TicketPredefinedReply::class);
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'q' => ['nullable', 'string', 'max:255'],
            'department_id' => ['nullable', 'integer', 'exists:ticket_departments,id'],
        ];
    }
}
