<?php

namespace App\Http\Requests\Admin;

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

class TicketPredefinedReplyRecordsRequest 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 [
            'search.value' => 'nullable|string',
            'status' => 'nullable|boolean',
            'department_id' => 'nullable|exists:ticket_departments,id',
            'role_id' => 'nullable|exists:roles,id',
            'start' => 'nullable|integer|min:0',
            'length' => 'nullable|integer|min:1|max:100',
            'order.*.column' => 'nullable|integer',
            'order.*.dir' => 'nullable|in:asc,desc',
        ];
    }
}
