namespace Eis.Infrastructure.Authentication;

internal sealed record LoginChallenge(string UserId, int Attempts);

internal sealed record TotpSetup(string UserId, string Secret);

internal interface IAuthenticationStateStore
{
    string Backend { get; }

    int? Database { get; }

    int SessionTtlSeconds { get; }

    Task CreateSessionAsync(string token, string userId);

    Task<string?> GetSessionUserIdAsync(string token);

    Task DeleteSessionAsync(string token);

    Task<int> DeleteUserSessionsAsync(string userId);

    Task<int> DeleteUsersSessionsAsync(IEnumerable<string> userIds);

    Task CreateLoginChallengeAsync(string key, string userId);

    Task<LoginChallenge?> GetLoginChallengeAsync(string key);

    Task<LoginChallenge?> RecordLoginChallengeFailureAsync(string key, int maximumAttempts);

    Task DeleteLoginChallengeAsync(string key);

    Task CreateTotpSetupAsync(string token, string userId, string secret);

    Task<TotpSetup?> GetTotpSetupAsync(string token);

    Task DeleteTotpSetupAsync(string token);
}
