<?php

namespace App\Http\Resources\ClassProgress;

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

class ClassProgressShowResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        $weekly = $this['weekly_reports'] ?? [];

        return [
            'report' => new ClassProgressReportResource($this['report']),
            'weekly_reports' => ClassProgressReportResource::collection(collect($weekly)),
            'status_options' => $this['status_options'] ?? [],
        ];
    }
}
