<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    /**
     * @return array<string, array<int, mixed>>
     */
    public function rules(): array
    {
        return [
            'settled_amount' => ['required', 'numeric', 'min:0'],
            'received_by_name' => ['nullable', 'string', 'max:255'],
            'settlement_notes' => ['nullable', 'string', 'max:2000'],
        ];
    }
}
