<?php

namespace App\Http\Requests\Expenses;

use App\Http\Requests\ApiFormRequest;

class StoreExpenseRequest 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' => ['required', 'file', 'max:2048', 'mimes:jpg,jpeg,png,webp,gif,pdf'],
            'school_year' => ['nullable', 'string'],
            'semester' => ['nullable', 'string'],
        ];
    }
}
