using ColaFlow.Modules.Identity.Domain.Aggregates.Invitations;
using ColaFlow.Modules.Identity.Domain.Aggregates.Tenants;

namespace ColaFlow.Modules.Identity.Domain.Repositories;

/// <summary>
/// Repository interface for Invitation aggregate
/// </summary>
public interface IInvitationRepository
{
    /// <summary>
    /// Gets an invitation by its ID
    /// </summary>
    Task<Invitation?> GetByIdAsync(InvitationId id, CancellationToken cancellationToken = default);

    /// <summary>
    /// Gets an invitation by token hash (for acceptance flow)
    /// </summary>
    Task<Invitation?> GetByTokenHashAsync(string tokenHash, CancellationToken cancellationToken = default);

    /// <summary>
    /// Gets all pending invitations for a tenant
    /// </summary>
    Task<List<Invitation>> GetPendingByTenantAsync(TenantId tenantId, CancellationToken cancellationToken = default);

    /// <summary>
    /// Gets a pending invitation by email and tenant (for duplicate check)
    /// </summary>
    Task<Invitation?> GetPendingByEmailAndTenantAsync(string email, TenantId tenantId, CancellationToken cancellationToken = default);

    /// <summary>
    /// Adds a new invitation
    /// </summary>
    Task AddAsync(Invitation invitation, CancellationToken cancellationToken = default);

    /// <summary>
    /// Updates an existing invitation
    /// </summary>
    Task UpdateAsync(Invitation invitation, CancellationToken cancellationToken = default);

    /// <summary>
    /// Deletes an invitation
    /// </summary>
    Task DeleteAsync(Invitation invitation, CancellationToken cancellationToken = default);
}
