<?php

namespace App\Http\Resources\Whatsapp;

use Illuminate\Http\Resources\Json\JsonResource;

class WhatsappClassSectionParentResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'class_section_id' => (int) ($this['class_section_id'] ?? 0),
            'primary_id' => (int) ($this['primary_id'] ?? 0),
            'primary_name' => (string) ($this['primary_name'] ?? ''),
            'primary_phone' => (string) ($this['primary_phone'] ?? ''),
            'primary_email' => (string) ($this['primary_email'] ?? ''),
            'second_id' => (int) ($this['second_id'] ?? 0),
            'second_name' => (string) ($this['second_name'] ?? ''),
            'second_phone' => (string) ($this['second_phone'] ?? ''),
            'second_email' => (string) ($this['second_email'] ?? ''),
            'primary_member' => $this['primary_member'] ?? null,
            'second_member' => $this['second_member'] ?? null,
        ];
    }
}
