namespace ColaFlow.Modules.Identity.Application.Services;

/// <summary>
/// Rate limiting service to prevent brute force attacks
/// </summary>
public interface IRateLimitService
{
    /// <summary>
    /// Check if an action is allowed based on rate limit
    /// </summary>
    /// <param name="key">Unique key for the rate limit (e.g., "forgot-password:user@example.com")</param>
    /// <param name="maxAttempts">Maximum number of attempts allowed</param>
    /// <param name="window">Time window for rate limiting</param>
    /// <param name="cancellationToken">Cancellation token</param>
    /// <returns>True if allowed, false if rate limit exceeded</returns>
    Task<bool> IsAllowedAsync(
        string key,
        int maxAttempts,
        TimeSpan window,
        CancellationToken cancellationToken = default);
}
