using System.Diagnostics.CodeAnalysis;
using OliverBooth.Common.Data.Web.Users;
namespace OliverBooth.Common.Services;
///
/// Represents a service which manages users.
///
public interface IUserService
{
///
/// Clears all expired tokens.
///
void ClearExpiredTokens();
///
/// Clears all tokens.
///
void ClearTokens();
///
/// Creates a temporary MFA token for the specified user.
///
/// The user for whom to create the token.
/// The newly-created token.
/// is .
IMfaToken CreateMfaToken(IUser user);
///
/// Deletes the specified token.
///
/// The token to delete.
/// is .
void DeleteToken(string token);
///
/// Attempts to find a user by their unique ID.
///
/// The ID of the user to return.
///
/// When this method returns, contains the user whose ID is equal to the specified , if
/// such a user exists; otherwise, .
///
///
/// if a user was found with the specified ; otherwise,
/// .
///
bool TryGetUser(Guid id, [NotNullWhen(true)] out IUser? user);
///
/// Verifies the login information of the specified user.
///
/// The email address.
/// The password.
///
/// When this method returns, contains the user associated with the login credentials, or
/// if the credentials are invalid.
///
///
/// if the login credentials are valid; otherwise, .
///
bool VerifyLogin(string email, string password, [NotNullWhen(true)] out IUser? user);
///
/// Verifies the MFA request for the specified user.
///
/// The MFA token.
/// The user-provided TOTP.
///
/// When this method returns, contains the user associated with the specified token, if the verification was
/// successful; otherwise, .
///
///
/// An representing the result of the request.
///
///
/// is .
/// -or-
/// is .
///
MfaRequestResult VerifyMfaRequest(string token, string totp, out IUser? user);
}