<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StoreCashHandoverRequest extends FormRequest
{
    public function authorize(): bool
    {
        return (bool) $this->user()?->can('cash-handovers.create');
    }

    /**
     * @return array<string, array<int, mixed>>
     */
    public function rules(): array
    {
        return [
            'handover_date' => ['required', 'date'],
            'declared_amount' => ['required', 'numeric', 'min:0'],
            'notes' => ['nullable', 'string', 'max:2000'],
        ];
    }
}
