<?php

namespace App\Http\Resources\Reports\ReportCards;

use Illuminate\Http\Resources\Json\JsonResource;

class ReportCardClassSectionResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => (int) ($this['id'] ?? 0),
            'class_section_id' => (int) ($this['class_section_id'] ?? ($this['id'] ?? 0)),
            'class_section_name' => (string) ($this['class_section_name'] ?? ''),
            'school_year' => (string) ($this['school_year'] ?? ''),
        ];
    }
}
