<?php

namespace App\Http\Requests\Finance;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'branch_id' => ['required', 'integer'],
            'counter_id' => ['nullable', 'integer'],
            'opening_cash' => ['required', 'decimal:0,2', 'min:0'],
        ];
    }
}
