<?php

namespace App\Http\Requests\Api\V1\Booking;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use App\Enums\BookingStatusEnum;

class IndexBookingRequest extends FormRequest
{

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


    public function rules(): array
    {
        return [
            'tab' => ['nullable', 'integer', 'in:1,2'],
            'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
            'booking_date' => ['nullable', 'date', 'date_format:Y-m-d'],
            'game_id' => ['nullable', 'integer', 'exists:games,id'],
            'court_id' => ['nullable', 'integer', 'exists:courts,id'],
            'status' => ['nullable', 'integer', Rule::in(BookingStatusEnum::values())],
            'sort_by' => ['nullable', 'string', 'in:id,booking_date,start_time,status,created_at'],
            'sort_dir' => ['nullable', 'string', 'in:asc,desc'],
            'search' => ['nullable', 'string', 'max:100'],

        ];
    }
}
