<?php

declare(strict_types=1);

namespace App\Module\Absence\Domain\Repository;

use App\Module\Absence\Domain\Entity\AbsenceRequest;
use App\Module\Absence\Domain\Enum\AbsenceStatus;
use App\Module\Absence\Domain\Enum\AbsenceType;
use App\Shared\Domain\Contract\UserInterface;
use DateTimeInterface;

interface AbsenceRequestRepositoryInterface
{
    public function findById(int $id): ?AbsenceRequest;

    /**
     * Whether the user already has a PENDING or APPROVED absence that overlaps
     * the given date range.
     */
    public function hasOverlap(
        UserInterface $user,
        DateTimeInterface $startDate,
        DateTimeInterface $endDate,
        ?int $excludeId = null,
    ): bool;

    /**
     * Absences (approved or pending) overlapping a date range, all employees.
     *
     * @return AbsenceRequest[]
     */
    public function findInRange(DateTimeInterface $from, DateTimeInterface $to): array;

    /**
     * @return AbsenceRequest[]
     */
    public function findFiltered(
        ?UserInterface $user = null,
        ?AbsenceStatus $status = null,
        ?AbsenceType $type = null,
        ?DateTimeInterface $from = null,
        ?DateTimeInterface $to = null,
    ): array;
}
