<?php

namespace App\Http\Resources\Finance;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class FinancialRefundResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'invoice_id' => (int) ($this->resource['invoice_id'] ?? 0),
            'school_year' => $this->resource['school_year'] ?? null,
            'total_refunded' => (float) ($this->resource['total_refunded'] ?? 0),
        ];
    }
}
