<?php

namespace App\Http\Resources\Fees;

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

class ChargeListResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'parent_id' => (int) ($this->resource['parent_id'] ?? 0),
            'school_year' => $this->resource['school_year'] ?? null,
            'extra_charges' => $this->resource['extra_charges'] ?? [],
            'event_charges' => $this->resource['event_charges'] ?? [],
        ];
    }
}
