<?php

declare(strict_types=1);

namespace App\Scolarite\Domain\Repository;

use App\Administration\Domain\Model\SchoolClass\ClassId;
use App\Administration\Domain\Model\Subject\SubjectId;
use App\Administration\Domain\Model\User\UserId;
use App\Scolarite\Domain\Exception\RemplacementNotFoundException;
use App\Scolarite\Domain\Model\TeacherReplacement\TeacherReplacement;
use App\Scolarite\Domain\Model\TeacherReplacement\TeacherReplacementId;
use App\Shared\Domain\Tenant\TenantId;
use DateTimeImmutable;

interface TeacherReplacementRepository
{
    public function save(TeacherReplacement $replacement): void;

    /** @throws RemplacementNotFoundException */
    public function get(TeacherReplacementId $id, TenantId $tenantId): TeacherReplacement;

    public function findById(TeacherReplacementId $id, TenantId $tenantId): ?TeacherReplacement;

    public function findActiveReplacement(
        UserId $replacementTeacherId,
        ClassId $classId,
        SubjectId $subjectId,
        DateTimeImmutable $at,
        TenantId $tenantId,
    ): ?TeacherReplacement;

    /** @return array<TeacherReplacement> */
    public function findActiveByTenant(TenantId $tenantId, DateTimeImmutable $at): array;

    /** @return array<TeacherReplacement> */
    public function findActiveByReplacementTeacher(
        UserId $replacementTeacherId,
        TenantId $tenantId,
        DateTimeImmutable $at,
    ): array;

    /** @return array<TeacherReplacement> */
    public function findExpired(DateTimeImmutable $at): array;
}
