<?php

declare(strict_types=1);

namespace App\Scolarite\Infrastructure\Api\Resource;

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Scolarite\Infrastructure\Api\Provider\StudentAveragesProvider;

#[ApiResource(
    shortName: 'StudentAverages',
    operations: [
        new Get(
            uriTemplate: '/students/{studentId}/averages',
            provider: StudentAveragesProvider::class,
            name: 'get_student_averages',
        ),
    ],
)]
final class StudentAveragesResource
{
    #[ApiProperty(identifier: true)]
    public ?string $studentId = null;

    public ?string $periodId = null;

    /** @var list<array{subjectId: string, subjectName: string|null, average: float, gradeCount: int}> */
    public array $subjectAverages = [];

    public ?float $generalAverage = null;
}
