using Predictalytics.Domain.Enums;

namespace Predictalytics.Application.Interfaces;

/// <summary>
/// Token-bucket rate limiter for platform API calls.
/// </summary>
public interface IRateLimiter
{
    /// <summary>Wait until a request can be made to the given platform.</summary>
    Task WaitAsync(PlatformType platform, CancellationToken ct = default, string endpointGroup = "Default", string? channelId = null);

    /// <summary>Check if a request can be made immediately.</summary>
    bool CanMakeRequest(PlatformType platform, string endpointGroup = "Default", string? channelId = null);

    /// <summary>Report that a 429 Too Many Requests was received.</summary>
    void ReportRateLimitExceeded(PlatformType platform, TimeSpan? retryAfter = null, string endpointGroup = "Default", string? channelId = null);
}
