<?php

namespace App\Http\Requests\Expenses;

use App\Http\Requests\ApiFormRequest;

class UpdateExpenseRequest extends ApiFormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'category' => ['required', 'in:Expense,Purchase,Reimbursement,Donation'],
            'amount' => ['required', 'numeric', 'gt:0'],
            'purchased_by' => ['required', 'integer', 'min:1'],
            'retailor' => ['nullable', 'string', 'max:255'],
            'date_of_purchase' => ['required', 'date_format:Y-m-d'],
            'description' => ['nullable', 'string'],
            'receipt' => ['nullable', 'file', 'max:2048', 'mimes:jpg,jpeg,png,webp,gif,pdf'],
            'remove_receipt' => ['nullable', 'boolean'],
        ];
    }
}
