<?php

namespace App\Http\Resources\Classes;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class ClassAttendanceResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'teacher_name' => $this->resource['teacher_name'] ?? null,
            'class_name' => $this->resource['class_name'] ?? null,
            'class_section_id' => $this->resource['class_section_id'] ?? null,
            'semester' => $this->resource['semester'] ?? null,
            'school_year' => $this->resource['school_year'] ?? null,
            'students' => ClassAttendanceStudentResource::collection($this->resource['students'] ?? []),
        ];
    }
}
