using ColaFlow.Modules.Identity.Domain.Aggregates.Users;
using ColaFlow.Modules.Identity.Domain.Entities;

namespace ColaFlow.Modules.Identity.Domain.Repositories;

/// <summary>
/// Repository interface for PasswordResetToken entity
/// </summary>
public interface IPasswordResetTokenRepository
{
    /// <summary>
    /// Get password reset token by token hash
    /// </summary>
    Task<PasswordResetToken?> GetByTokenHashAsync(
        string tokenHash,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// Add a new password reset token
    /// </summary>
    Task AddAsync(
        PasswordResetToken token,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// Update an existing password reset token
    /// </summary>
    Task UpdateAsync(
        PasswordResetToken token,
        CancellationToken cancellationToken = default);

    /// <summary>
    /// Invalidate all active password reset tokens for a user
    /// This is called when a new reset request is made
    /// </summary>
    Task InvalidateAllForUserAsync(
        UserId userId,
        CancellationToken cancellationToken = default);
}
