<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class EstimatePackageRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()?->hasPermission('packages.view') ?? false;
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'guest_count' => ['nullable', 'integer', 'min:1'],
            'billable_days' => ['nullable', 'integer', 'min:1'],
            'billable_hours' => ['nullable', 'numeric', 'min:0'],
            'overall_discount_amount' => ['nullable', 'numeric', 'min:0'],
            'overall_discount_percent' => ['nullable', 'numeric', 'min:0'],
            'service_charge_rate' => ['nullable', 'numeric', 'min:0'],
            'service_charge_amount' => ['nullable', 'numeric', 'min:0'],
            'deposit_percent' => ['nullable', 'numeric', 'min:0'],
            'amount_paid' => ['nullable', 'numeric', 'min:0'],
        ];
    }
}
