<?php

namespace App\Http\Resources\Teachers;

use Illuminate\Http\Resources\Json\JsonResource;

class TeacherStudentResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'student_id' => (int) ($this['student_id'] ?? 0),
            'firstname' => (string) ($this['firstname'] ?? ''),
            'lastname' => (string) ($this['lastname'] ?? ''),
            'school_id' => $this['school_id'] ?? null,
            'is_new' => $this['is_new'] ?? null,
            'photo_consent' => $this['photo_consent'] ?? null,
            'age' => $this['age'] ?? null,
            'school_year' => $this['school_year'] ?? null,
            'class_section_id' => $this['class_section_id'] ?? null,
            'medical_conditions' => $this['medical_conditions'] ?? [],
            'allergies' => $this['allergies'] ?? [],
            'medical_conditions_text' => $this['medical_conditions_text'] ?? '',
            'allergies_text' => $this['allergies_text'] ?? '',
        ];
    }
}
