<?php

namespace App\Http\Requests\Audit;

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

class AuditLogIndexRequest extends FormRequest
{
    use HasPagination;

    /**
     * 감사 로그 조회용 확장 - 최대 200개 허용
     */
    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',
            'target_type' => 'nullable|string|max:100',
            'target_id' => 'nullable|integer|min:1',
            'action' => 'nullable|string|max:50',
            'actor_id' => 'nullable|integer|min:1',
            'from' => 'nullable|date',
            'to' => 'nullable|date|after_or_equal:from',
            'sort' => 'nullable|string|in:created_at',
            'order' => 'nullable|string|in:asc,desc',
        ];
    }
}
