<?php

declare(strict_types=1);

namespace App\Scolarite\Domain\Repository;

use App\Administration\Domain\Model\SchoolClass\ClassId;
use App\Administration\Domain\Model\User\UserId;
use App\Scolarite\Domain\Exception\ScheduleSlotNotFoundException;
use App\Scolarite\Domain\Model\Schedule\DayOfWeek;
use App\Scolarite\Domain\Model\Schedule\ScheduleSlot;
use App\Scolarite\Domain\Model\Schedule\ScheduleSlotId;
use App\Shared\Domain\Tenant\TenantId;

interface ScheduleSlotRepository
{
    public function save(ScheduleSlot $slot): void;

    /** @throws ScheduleSlotNotFoundException */
    public function get(ScheduleSlotId $id, TenantId $tenantId): ScheduleSlot;

    public function findById(ScheduleSlotId $id, TenantId $tenantId): ?ScheduleSlot;

    public function delete(ScheduleSlotId $id, TenantId $tenantId): void;

    /** @return array<ScheduleSlot> */
    public function findByClass(ClassId $classId, TenantId $tenantId): array;

    /** @return array<ScheduleSlot> */
    public function findRecurringByClass(ClassId $classId, TenantId $tenantId): array;

    /** @return array<ScheduleSlot> */
    public function findByTeacher(UserId $teacherId, TenantId $tenantId): array;

    /** @return array<ScheduleSlot> */
    public function findOverlappingForClass(
        ClassId $classId,
        DayOfWeek $dayOfWeek,
        string $startTime,
        string $endTime,
        TenantId $tenantId,
        ?ScheduleSlotId $excludeId = null,
    ): array;

    /** @return array<ScheduleSlot> */
    public function findOverlappingForTeacher(
        UserId $teacherId,
        DayOfWeek $dayOfWeek,
        string $startTime,
        string $endTime,
        TenantId $tenantId,
        ?ScheduleSlotId $excludeId = null,
    ): array;

    /** @return array<ScheduleSlot> */
    public function findOverlappingForRoom(
        string $room,
        DayOfWeek $dayOfWeek,
        string $startTime,
        string $endTime,
        TenantId $tenantId,
        ?ScheduleSlotId $excludeId = null,
    ): array;
}
