<?php

namespace App\Http\Resources\Fees;

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

class FeeRefundResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'refund_amount' => (float) ($this->resource['refund_amount'] ?? 0),
            'total_paid' => (float) ($this->resource['total_paid'] ?? 0),
            'refund_deadline' => $this->resource['refund_deadline'] ?? null,
            'school_end_date' => $this->resource['school_end_date'] ?? null,
            'weeks_of_study' => (float) ($this->resource['weeks_of_study'] ?? 0),
            'withdrawn_students' => (int) ($this->resource['withdrawn_students'] ?? 0),
        ];
    }
}
