<?php

namespace App\Http\Resources\Scores;

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

class ScoreCommentResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'student_id' => (int) ($this->resource['student_id'] ?? 0),
            'firstname' => $this->resource['firstname'] ?? null,
            'lastname' => $this->resource['lastname'] ?? null,
            'school_id' => $this->resource['school_id'] ?? null,
            'comments' => $this->resource['comments'] ?? [],
        ];
    }
}
