<?php

namespace App\Http\Resources\Reports\ReportCards;

use Illuminate\Http\Resources\Json\JsonResource;

class ReportCardCompletenessStudentResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => (int) ($this['id'] ?? 0),
            'name' => (string) ($this['name'] ?? ''),
            'missing' => array_values($this['missing'] ?? []),
            'warnings' => array_values($this['warnings'] ?? []),
            'complete' => (bool) ($this['complete'] ?? false),
            'viewed_at' => $this['viewed_at'] ?? null,
            'signed_at' => $this['signed_at'] ?? null,
            'signed_name' => $this['signed_name'] ?? null,
        ];
    }
}
