using e_suite.Database.Audit;
using e_suite.Database.Core;
using e_suite.Database.Core.Models;
using e_suite.Database.Core.Tables.Domain;
using e_suite.Database.Core.Tables.UserManager;
using eSuite.Core.Miscellaneous;

namespace e_suite.API.Common.repository;

public interface IUserManagerRepository : IRepository
{
    Task<User?> GetUserByEmail(string loginEmail, CancellationToken cancellationToken);
    Task<User?> GetUserSsoId(long ssoId, string ssoUserId, CancellationToken cancellationToken);
    Task<User?> GetUserByDomainSsoId(long domainSsoId, string ssoUserId, CancellationToken cancellationToken);
    
    Task AddEmailUserAction(AuditUserDetails auditUserDetails, EmailUserAction emailConfirmation,
        CancellationToken cancellationToken);
    Task AddUser(AuditUserDetails auditUserDetails, User user, CancellationToken cancellationToken);
    Task EditUser(AuditUserDetails auditUserDetails, User user, CancellationToken cancellationToken);
    Task<EmailUserAction?> GetEmailUserAction(Guid token, CancellationToken cancellationToken);
    Task<EmailUserAction?> GetCurrentEmailUserAction(long userId, EmailUserActionType emailUserActionType, CancellationToken cancellationToken);
    Task DeleteEmailUserAction(AuditUserDetails auditUserDetails, EmailUserAction emailUserAction, CancellationToken cancellationToken);
    IQueryable<User> GetUsers();
    User? GetUserById(IGeneralIdRef generalIdRef);
    Task<User?> GetUserByIdAsync(IGeneralIdRef generalIdRef, CancellationToken cancellationToken);
    Task<SsoProvider?> GetSsoProviderById(long id, CancellationToken cancellationToken);
    IQueryable<SsoProvider> GetSsoProviders();
    Task SaveSingleUseGuidForUser(SingleUseGuid singleUseGuid, CancellationToken cancellationToken);
    Task<User?> GetUserBySingleUseGuid(Guid guid, CancellationToken cancellationToken);
    Task DeleteSingleUseGuid(Guid guid, CancellationToken cancellationToken);
    Task<Domain?> GetDomainById(GeneralIdRef userRegistrationDomainId, CancellationToken cancellationToken);
    Task DeleteExpiredEmailUserActions();
    Task DeleteExpiredSingleUseGuids();
}