<?php

namespace App\Http\Resources\Families;

use Illuminate\Http\Resources\Json\JsonResource;

class FamilyGuardianResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'user_id' => (int) ($this['user_id'] ?? 0),
            'firstname' => (string) ($this['firstname'] ?? ''),
            'lastname' => (string) ($this['lastname'] ?? ''),
            'email' => (string) ($this['email'] ?? ''),
            'cellphone' => (string) ($this['cellphone'] ?? ''),
            'address_street' => (string) ($this['address_street'] ?? ''),
            'city' => (string) ($this['city'] ?? ''),
            'state' => (string) ($this['state'] ?? ''),
            'zip' => (string) ($this['zip'] ?? ''),
            'relation' => (string) ($this['relation'] ?? ''),
            'is_primary' => (bool) ($this['is_primary'] ?? false),
            'receive_emails' => (bool) ($this['receive_emails'] ?? false),
            'receive_sms' => (bool) ($this['receive_sms'] ?? false),
        ];
    }
}
