<?php

namespace App\Http\Requests\Approval;

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

class InboxIndexRequest extends FormRequest
{
    use HasPagination;

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

    public function rules(): array
    {
        return [
            'status' => 'nullable|string|in:requested,scheduled,completed,rejected',
            'sort_by' => 'nullable|string|in:created_at,drafted_at,completed_at,title',
            'sort_dir' => 'nullable|string|in:asc,desc',
            'per_page' => 'nullable|integer|min:1',
            'page' => 'nullable|integer|min:1',
            'start_date' => 'nullable|date_format:Y-m-d',
            'end_date' => 'nullable|date_format:Y-m-d|after_or_equal:start_date',
        ];
    }
}
