<?php

declare(strict_types=1);

namespace App\Scolarite\Domain\Repository;

use App\Administration\Domain\Model\Subject\SubjectId;
use App\Administration\Domain\Model\User\UserId;
use App\Shared\Domain\Tenant\TenantId;

interface StudentAverageRepository
{
    public function saveSubjectAverage(
        TenantId $tenantId,
        UserId $studentId,
        SubjectId $subjectId,
        string $periodId,
        float $average,
        int $gradeCount,
    ): void;

    public function saveGeneralAverage(
        TenantId $tenantId,
        UserId $studentId,
        string $periodId,
        float $average,
    ): void;

    /** @return list<float> Moyennes matières d'un élève pour une période */
    public function findSubjectAveragesForStudent(
        UserId $studentId,
        string $periodId,
        TenantId $tenantId,
    ): array;

    /** @return list<array{subjectId: string, subjectName: string|null, average: float, gradeCount: int}> */
    public function findDetailedSubjectAveragesForStudent(
        UserId $studentId,
        string $periodId,
        TenantId $tenantId,
    ): array;

    public function findGeneralAverageForStudent(
        UserId $studentId,
        string $periodId,
        TenantId $tenantId,
    ): ?float;

    public function deleteSubjectAverage(
        UserId $studentId,
        SubjectId $subjectId,
        string $periodId,
        TenantId $tenantId,
    ): void;

    public function deleteGeneralAverage(
        UserId $studentId,
        string $periodId,
        TenantId $tenantId,
    ): void;
}
