<?php

namespace App\Http\Requests\Attendance;

use App\Http\Requests\ApiFormRequest;

class LateSlipLogIndexRequest extends ApiFormRequest
{
    public function authorize(): bool
    {
        return $this->user() !== null;
    }

    public function rules(): array
    {
        return [
            'school_year' => ['nullable', 'string', 'max:9'],
            'semester' => ['nullable', 'string', 'max:255'],
            'q' => ['nullable', 'string', 'max:120'],
            'date_from' => ['nullable', 'date'],
            'date_to' => ['nullable', 'date'],
            'sort_by' => ['nullable', 'string', 'in:id,slip_date,student_name,printed_at,updated_at'],
            'sort_dir' => ['nullable', 'string', 'in:asc,desc'],
            'page' => ['nullable', 'integer', 'min:1'],
            'per_page' => ['nullable', 'integer', 'min:1', 'max:200'],
        ];
    }
}
