<?php

namespace App\Http\Resources\Attendance;

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

class TeacherGridResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'semester' => $this['semester'] ?? null,
            'school_year' => $this['school_year'] ?? null,
            'date' => $this['date'] ?? null,
            'class_section_id' => $this['class_section_id'] ?? null,
            'sections' => $this['sections'] ?? [],
            'grid' => $this['grid'] ?? [],
            'locked' => (bool)($this['locked'] ?? false),
        ];
    }
}