<?php

namespace App\Http\Resources\Parents;

use Illuminate\Http\Resources\Json\JsonResource;

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