/**
 * Rate Limiter Middleware
 * Token bucket implementation for request rate limiting
 * Zero-dependency implementation
 */
import type { IRequest } from '../http/Request';
import { type MiddlewareFailureResponder } from './MiddlewareFailureResponder';
import type { Middleware } from './MiddlewareStack';
export interface RateLimitOptions {
    windowMs: number;
    max: number;
    message?: string;
    statusCode?: number;
    headers?: boolean;
    keyGenerator?: (req: IRequest) => string;
    /**
     * Optional store selection for this middleware instance.
     * - 'memory' uses an in-process Map (default)
     * - 'redis' uses Cache.store('redis')
     * - 'kv' uses Cache.store('kv')
     * - 'db' uses Cache.store('mongodb')
     */
    store?: RateLimitStoreName;
    onFailure?: MiddlewareFailureResponder;
}
export type RateLimitStoreName = 'memory' | 'redis' | 'kv' | 'db';
export declare const RateLimiter: Readonly<{
    /**
     * Configure the store used by the programmatic API (attempt/tooManyAttempts/till/clear).
     * Defaults to 'memory'.
     */
    configure(config?: {
        store?: RateLimitStoreName;
    }): void;
    /**
     * Attempt to perform an action.
     *
     * Returns true if allowed (and records the hit), false if rate limited.
     */
    attempt(key: string, maxAttempts: number, decaySeconds: number): Promise<boolean>;
    /**
     * Check if the key is currently rate limited.
     */
    tooManyAttempts(key: string, maxAttempts: number): Promise<boolean>;
    /**
     * Seconds until the key is available again.
     * Returns 0 if not rate limited.
     */
    till(key: string): Promise<number>;
    /**
     * Clear rate limit state for a key.
     */
    clear(key: string): Promise<void>;
    /**
     * Create rate limiter middleware
     */
    create(options?: RateLimitOptions): Middleware;
}>;
//# sourceMappingURL=RateLimiter.d.ts.map