using OmsorgCore.Domain.Entities;

namespace OmsorgCore.Application.Abstractions;

public interface IContractRepository
{
    Task<Contract?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);
    Task<IReadOnlyList<Contract>> GetAllAsync(CancellationToken cancellationToken = default);
    Task<(IReadOnlyList<Contract> Items, int TotalCount)> GetPagedAsync(
        string? search,
        string? status,
        Guid? employeeId,
        Guid? facilityId,
        int page,
        int pageSize,
        CancellationToken cancellationToken = default);
    /// <summary>
    /// Liefert den ersten aktiven Vertrag (Status != "Entwurf") der Mitarbeiterin, dessen Zeitraum
    /// [startDate, endDate] vollständig abdeckt, oder null - Basis der Vertrags- und der
    /// Arbeitszeit-Prüfung (WeeklyHours) in FR-EM-3.
    /// </summary>
    Task<Contract?> GetActiveForEmployeeCoveringRangeAsync(
        Guid employeeId,
        DateOnly startDate,
        DateOnly endDate,
        CancellationToken cancellationToken = default);

    Task AddAsync(Contract contract, CancellationToken cancellationToken = default);
    Task UpdateAsync(Contract contract, CancellationToken cancellationToken = default);
    Task<bool> SoftDeleteAsync(Guid id, CancellationToken cancellationToken = default);
    Task<IReadOnlyList<Contract>> GetDeletedAsync(string? search, CancellationToken cancellationToken = default);
    Task<bool> RestoreAsync(Guid id, CancellationToken cancellationToken = default);
    Task SaveChangesAsync(CancellationToken cancellationToken = default);
}
