<?php

namespace App\Http\Resources\Families;

use Illuminate\Http\Resources\Json\JsonResource;

class FamilyEmergencyContactResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => (int) ($this['id'] ?? 0),
            'parent_id' => (int) ($this['parent_id'] ?? 0),
            'parent_label' => (string) ($this['parent_label'] ?? ''),
            'emergency_contact_name' => (string) ($this['emergency_contact_name'] ?? ''),
            'relation' => (string) ($this['relation'] ?? ''),
            'cellphone' => (string) ($this['cellphone'] ?? ''),
            'email' => (string) ($this['email'] ?? ''),
            'school_year' => (string) ($this['school_year'] ?? ''),
            'semester' => (string) ($this['semester'] ?? ''),
            'created_at' => $this['created_at'] ?? null,
            'updated_at' => $this['updated_at'] ?? null,
        ];
    }
}
