<?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\StudentMyAveragesProvider;

#[ApiResource(
    shortName: 'StudentMyAverages',
    operations: [
        new Get(
            uriTemplate: '/me/averages',
            provider: StudentMyAveragesProvider::class,
            name: 'get_my_averages',
        ),
    ],
)]
final class StudentMyAveragesResource
{
    #[ApiProperty(identifier: true)]
    public string $studentId = 'me';

    public ?string $periodId = null;

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

    public ?float $generalAverage = null;
}
