using Domain.Entities;
namespace Infrastructure.Repository.Auth;
///
/// Repository for authentication-related database operations including user registration and credential management.
///
public interface IAuthRepository
{
///
/// Registers a new user with account details and initial credential.
/// Uses stored procedure: USP_RegisterUser
///
/// Unique username for the user
/// User's first name
/// User's last name
/// User's email address
/// User's date of birth
/// Hashed password
/// The newly created UserAccount with generated ID
Task RegisterUserAsync(
string username,
string firstName,
string lastName,
string email,
DateTime dateOfBirth,
string passwordHash
);
///
/// Retrieves a user account by email address (typically used for login).
/// Uses stored procedure: usp_GetUserAccountByEmail
///
/// Email address to search for
/// UserAccount if found, null otherwise
Task GetUserByEmailAsync(string email);
///
/// Retrieves a user account by username (typically used for login).
/// Uses stored procedure: usp_GetUserAccountByUsername
///
/// Username to search for
/// UserAccount if found, null otherwise
Task GetUserByUsernameAsync(string username);
///
/// Retrieves the active (non-revoked) credential for a user account.
/// Uses stored procedure: USP_GetActiveUserCredentialByUserAccountId
///
/// ID of the user account
/// Active UserCredential if found, null otherwise
Task GetActiveCredentialByUserAccountIdAsync(
Guid userAccountId
);
///
/// Rotates a user's credential by invalidating all existing credentials and creating a new one.
/// Uses stored procedure: USP_RotateUserCredential
///
/// ID of the user account
/// New hashed password
Task RotateCredentialAsync(Guid userAccountId, string newPasswordHash);
///
/// Marks a user account as confirmed.
///
/// ID of the user account to confirm
/// The confirmed UserAccount entity
/// If user account not found
Task ConfirmUserAccountAsync(Guid userAccountId);
///
/// Retrieves a user account by ID.
///
/// ID of the user account
/// UserAccount if found, null otherwise
Task GetUserByIdAsync(Guid userAccountId);
///
/// Checks whether a user account has been verified.
///
/// ID of the user account
/// True if the user has a verification record, false otherwise
Task IsUserVerifiedAsync(Guid userAccountId);
}