<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class BookingPriceAdjustmentRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'type' => ['required', 'string'],
            'name' => ['required', 'string'],
            'description' => ['nullable', 'string'],

            'value' => ['required', 'numeric'],
            'value_type' => ['required', 'in:fixed,percentage'],
            'direction' => ['required', 'in:add,subtract'],

            'min_rooms' => ['nullable', 'integer'],
            'max_rooms' => ['nullable', 'integer'],

            'min_nights' => ['nullable', 'integer'],
            'max_nights' => ['nullable', 'integer'],

            'min_total' => ['nullable', 'numeric'],
            'max_total' => ['nullable', 'numeric'],

            'start_date' => ['nullable', 'date'],
            'end_date' => ['nullable', 'date', 'after_or_equal:start_date'],

            'is_active' => ['nullable', 'boolean'],
        ];
    }
}
