<?php

namespace App\Http\Requests\Audit;

use App\Http\Requests\Traits\HasPagination;
use Illuminate\Foundation\Http\FormRequest;

class TriggerAuditLogIndexRequest extends FormRequest
{
    use HasPagination;

    protected int $maxSize = 200;

    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'page' => 'nullable|integer|min:1',
            'size' => 'nullable|integer|min:1',
            'table_name' => 'nullable|string|max:64',
            'row_id' => 'nullable|string|max:64',
            'dml_type' => 'nullable|string|in:INSERT,UPDATE,DELETE',
            'tenant_id' => 'nullable|integer|min:1',
            'actor_id' => 'nullable|integer|min:1',
            'db_user' => 'nullable|string|max:100',
            'from' => 'nullable|date',
            'to' => 'nullable|date|after_or_equal:from',
            'sort' => 'nullable|string|in:created_at,id',
            'order' => 'nullable|string|in:asc,desc',
        ];
    }
}
