using Data.SeaHavenIndustries;
namespace SeaHaven.DataServices.Interfaces
{
public interface IForgetPasswordDataService
{
///
/// In one transaction, deletes every pending code for the email and every expired
/// code, then stores the new one.
///
Task ReplaceCodeAsync(string email, string userId, string codeHash, string codeSalt, DateTime expiresAtUtc, DateTime nowUtc, CancellationToken cancellationToken);
Task PurgeExpiredAsync(DateTime nowUtc, CancellationToken cancellationToken);
/// Returns the pending code for exactly this email, or null.
Task GetByEmailAsync(string email, CancellationToken cancellationToken);
///
/// Atomically consumes one attempt when the code is unexpired and has fewer
/// than consumed. Returns false otherwise.
///
Task TryConsumeAttemptAsync(int id, int maxAttempts, DateTime nowUtc, CancellationToken cancellationToken);
/// Gives back an attempt consumed by a check that matched.
Task RefundAttemptAsync(int id, CancellationToken cancellationToken);
Task RemoveByEmailAsync(string email, CancellationToken cancellationToken);
///
/// Deletes the email's codes issued up to and including ,
/// leaving any code issued after it by a concurrent request.
///
Task RemoveIssuedThroughAsync(string email, int throughId, CancellationToken cancellationToken);
}
}