using e_suite.API.Common.models;
using e_suite.Database.Audit;
using e_suite.Database.Core.Models;
using e_suite.Database.Core.Tables.UserManager;
using e_suite.Utilities.Pagination;
using eSuite.Core.Miscellaneous;

namespace e_suite.API.Common;

public interface IUserManager
{
    Task<LoginResponse> Login(Login login, CancellationToken cancellationToken = default!);
    Task<LoginResponse> LoginSso(long ssoId, string ssoUserId, CancellationToken cancellationToken = default!);
    Task ForgotPassword(string email, CancellationToken cancellationToken = default!);
    Task CreateUser(AuditUserDetails auditUserDetails, UserRegistration userRegistration, CancellationToken cancellationToken = default!);
    Task<LoginResponse> RefreshToken(string email, CancellationToken cancellationToken = default!);
    Task<LoginResponse> RefreshToken(IGeneralIdRef id, CancellationToken cancellationToken = default!);
    Task<User> CompleteEmailAction(EmailActionToken token, CancellationToken cancellationToken = default!);
    Task DeactivateUser(AuditUserDetails auditUserDetails, string email, CancellationToken cancellationToken = default!);
    Task DeactivateUser(AuditUserDetails auditUserDetails, GeneralIdRef generalIdRef, CancellationToken cancellationToken = default!);
    Task<UserProfile> GetProfile(string email, CancellationToken cancellationToken = default!);
    Task UpdateProfile(AuditUserDetails auditUserDetails, string email, UpdatedUserProfile userProfile, CancellationToken cancellationToken = default!);
    Task<LoginResponse> PatchProfile( AuditUserDetails auditUserDetails, string email, PatchUserProfile patchUserProfile, CancellationToken cancellationToken );
    Task<IPaginatedData<GetUser>> GetUsersAsync(Paging paging, CancellationToken cancellationToken);
    Task<GetUser?> GetUserAsync(GeneralIdRef generalIdRef, CancellationToken cancellationToken);
    Task<User> GetUserByEmailAsync(string email, CancellationToken cancellationToken);

    Task EditUser(AuditUserDetails auditUserDetails, EditUser user, CancellationToken cancellationToken);
    Task ResendConfirmEmail(AuditUserDetails auditUserDetails, GeneralIdRef generalIdRef, CancellationToken cancellationToken);
    Task<string> GetCurrentEmailActionUrl(string emailAddress, EmailUserActionType emailUserActionType, CancellationToken cancellationToken );
    Task<SsoProvider?> GetSsoProviderForEmail(string loginEmail, CancellationToken cancellationToken);
    Task<SsoProvider?> GetSsoProviderById(long ssoProviderId, CancellationToken cancellationToken);
    Task LinkSsoProfileToUser(AuditUserDetails auditUserDetails, User user, long ssoId, string ssoUserId, bool setEmailConfirmed, CancellationToken cancellationToken);
    Task TurnOfSsoForUser(AuditUserDetails auditUserDetails, GeneralIdRef generalIdRef, CancellationToken cancellationToken);
    Task<Guid> CreateSingleUseGuid(AuditUserDetails auditUserDetails, GeneralIdRef generalIdRef, CancellationToken cancellationToken);
    Task<User?> GetUserWithSingleUseGuid(Guid guid, CancellationToken cancellationToken);
    Task SetAuthentication( AuditUserDetails auditUserDetails, UserAuthenticationDetails userAuthenticationDetails, bool setEmailConfirmed, CancellationToken cancellationToken );
    Task PatchUser(AuditUserDetails auditUserDetails, IGeneralIdRef userId, PatchUser patchUser, CancellationToken cancellationToken);
}