import { Logger } from '../../utils/logger.js';
/**
 * Rate limit response headers (JIRA, GitHub, ADO)
 */
export interface RateLimitHeaders {
    remaining?: number;
    reset?: number;
    retryAfter?: number;
}
/**
 * Rate limit check result
 */
export interface RateLimitCheckResult {
    canProceed: boolean;
    reason?: string;
    retryAfter?: number;
    remaining?: number;
}
/**
 * RateLimitChecker - Detects API rate limits and prevents hitting limits
 *
 * Features:
 * - Parses rate limit headers from JIRA, GitHub, ADO
 * - Handles 429 (Too Many Requests) errors
 * - Suggests using stale cache when rate limit low
 * - Supports exponential backoff
 *
 * Supported headers:
 * - X-RateLimit-Remaining (JIRA Cloud, GitHub)
 * - X-RateLimit-Reset (JIRA Cloud, GitHub)
 * - Retry-After (Standard HTTP, JIRA Server, ADO)
 * - x-ms-ratelimit-remaining (Azure DevOps)
 *
 * Threshold: 10 requests remaining (configurable)
 */
export declare class RateLimitChecker {
    private logger;
    private threshold;
    constructor(options?: {
        logger?: Logger;
        threshold?: number;
    });
    /**
     * Check if safe to proceed with API call based on response headers
     *
     * @param headers Response headers from previous API call
     * @returns RateLimitCheckResult with canProceed flag
     */
    shouldProceed(headers: RateLimitHeaders): RateLimitCheckResult;
    /**
     * Handle 429 (Too Many Requests) error
     *
     * @param error Error object with response headers
     * @returns Promise<void>
     */
    handleRateLimitError(error: any): Promise<void>;
    /**
     * Extract rate limit headers from HTTP response
     *
     * Supports multiple header formats:
     * - JIRA Cloud: X-RateLimit-Remaining, X-RateLimit-Reset
     * - GitHub: X-RateLimit-Remaining, X-RateLimit-Reset
     * - ADO: x-ms-ratelimit-remaining-resource, Retry-After
     * - Standard: Retry-After
     *
     * @param response HTTP response or response-like object
     * @returns RateLimitHeaders object
     */
    extractHeaders(response: any): RateLimitHeaders;
    /**
     * Extract Retry-After from error response
     *
     * @param error Error object
     * @returns Retry-After in seconds, or null
     */
    private extractRetryAfter;
    /**
     * Extract X-RateLimit-Reset from error response
     *
     * @param error Error object
     * @returns Reset timestamp (Unix seconds), or null
     */
    private extractReset;
    /**
     * Check if error is a rate limit error (429 status)
     *
     * @param error Error object
     * @returns True if 429 error
     */
    isRateLimitError(error: any): boolean;
}
//# sourceMappingURL=rate-limit-checker.d.ts.map