<?php

namespace App\Http\Resources\Families;

use Illuminate\Http\Resources\Json\JsonResource;

class FamilyPaymentResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => (int) ($this['id'] ?? 0),
            'parent_id' => (int) ($this['parent_id'] ?? 0),
            'invoice_id' => (int) ($this['invoice_id'] ?? 0),
            'paid_amount' => (float) ($this['paid_amount'] ?? 0),
            'balance' => (float) ($this['balance'] ?? 0),
            'payment_method' => (string) ($this['payment_method'] ?? ''),
            'payment_date' => $this['payment_date'] ?? null,
            'status' => (string) ($this['status'] ?? ''),
        ];
    }
}
