<?php

namespace App\Http\Resources\Teachers;

use Illuminate\Http\Resources\Json\JsonResource;

class TeacherAssignmentResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'teacher_id' => (int) ($this['teacher_id'] ?? 0),
            'firstname' => (string) ($this['firstname'] ?? ''),
            'lastname' => (string) ($this['lastname'] ?? ''),
            'name' => (string) ($this['name'] ?? ''),
            'email' => $this['email'] ?? null,
            'cellphone' => $this['cellphone'] ?? null,
            'role' => $this['role'] ?? null,
            'school_year' => $this['school_year'] ?? null,
            'main_assignments' => $this['main_assignments'] ?? [],
            'ta_assignments' => $this['ta_assignments'] ?? [],
        ];
    }
}
