namespace SpaceGame.Api.Auth.Simulation;

public interface IAuthRepository
{
    Task<UserAccount?> FindUserByEmailAsync(string email, CancellationToken cancellationToken);
    Task<UserAccount?> FindUserByIdAsync(Guid userId, CancellationToken cancellationToken);
    Task<IReadOnlyList<UserAccount>> ListUsersAsync(CancellationToken cancellationToken);
    Task<UserAccount> CreateUserAsync(string email, string passwordHash, IReadOnlyCollection<string> roles, CancellationToken cancellationToken);
    Task<UserAccount> UpsertUserAsync(string email, string passwordHash, IReadOnlyCollection<string> roles, CancellationToken cancellationToken);
    Task StoreRefreshTokenAsync(Guid userId, string tokenHash, DateTimeOffset expiresAtUtc, CancellationToken cancellationToken);
    Task<RefreshTokenRecord?> FindRefreshTokenAsync(string tokenHash, CancellationToken cancellationToken);
    Task RevokeRefreshTokenAsync(Guid refreshTokenId, CancellationToken cancellationToken);
    Task RevokeAllRefreshTokensAsync(Guid userId, CancellationToken cancellationToken);
    Task StorePasswordResetTokenAsync(Guid userId, string tokenHash, DateTimeOffset expiresAtUtc, CancellationToken cancellationToken);
    Task<PasswordResetTokenRecord?> FindPasswordResetTokenAsync(string tokenHash, CancellationToken cancellationToken);
    Task ConsumePasswordResetTokenAsync(Guid passwordResetTokenId, CancellationToken cancellationToken);
    Task UpdatePasswordHashAsync(Guid userId, string passwordHash, CancellationToken cancellationToken);
}
