import { NextRequest, NextResponse } from 'next/server';
import { type RateLimitTier } from '../rate-limit-redis';
export interface RateLimitResult {
    allowed: boolean;
    remaining: number;
    resetTime: number;
    limit: number;
}
/**
 * Verifica el rate limit para un identificador específico
 */
export declare function checkRateLimit(identifier: string, limit?: number, windowMs?: number): RateLimitResult;
/**
 * Rate limit types for distributed rate limiting
 * Re-export from rate-limit-redis for convenience
 */
export type { RateLimitTier };
/**
 * Check rate limit using Redis (distributed) when configured,
 * falls back to in-memory rate limiting otherwise.
 *
 * @param identifier - Unique identifier (IP, user ID, or combination)
 * @param type - Rate limit tier: 'auth' (5/15min), 'api' (100/1min), 'strict' (10/1hr), 'read' (200/1min), 'write' (50/1min)
 * @returns Promise with rate limit result
 */
export declare function checkDistributedRateLimit(identifier: string, type?: RateLimitTier): Promise<RateLimitResult & {
    retryAfter?: number;
}>;
/**
 * Create a 429 rate limit response
 */
export declare function createRateLimitErrorResponse(result: RateLimitResult & {
    retryAfter?: number;
}): NextResponse;
/**
 * Check if Redis-based distributed rate limiting might be available
 * (based on environment variables)
 */
export declare function isDistributedRateLimitAvailable(): boolean;
/**
 * Aplica rate limiting a una request API
 */
export declare function applyRateLimit(request: NextRequest, keyId: string, scopes: string[]): NextResponse | null;
/**
 * Agrega headers de rate limiting a una respuesta
 */
export declare function addRateLimitHeaders(response: NextResponse, keyId: string, scopes: string[]): NextResponse;
/**
 * Middleware helper para aplicar rate limiting automáticamente
 */
export declare function withRateLimit<T extends unknown[]>(handler: (request: NextRequest, ...args: T) => Promise<NextResponse>): (request: NextRequest, ...args: T) => Promise<NextResponse>;
/**
 * Obtiene estadísticas de rate limiting para un keyId
 */
export declare function getRateLimitStats(keyId: string): {
    currentUsage: number;
    resetTime: number;
    isNearLimit: boolean;
} | null;
/**
 * Limpia manualmente el rate limit para un keyId (útil para testing)
 */
export declare function clearRateLimit(keyId: string): void;
/**
 * Obtiene todas las estadísticas de rate limiting (útil para monitoring)
 */
export declare function getAllRateLimitStats(): Array<{
    keyId: string;
    count: number;
    resetTime: number;
}>;
/**
 * Obtiene estadísticas del cache de rate limiting
 */
export declare function getRateLimitCacheStats(): {
    total: number;
    active: number;
    expired: number;
    maxSize: number;
};
export declare function withRateLimitTier<T extends unknown[]>(handler: (request: NextRequest, ...args: T) => Promise<NextResponse>, tier?: RateLimitTier): (request: NextRequest, ...args: T) => Promise<NextResponse>;
//# sourceMappingURL=rate-limit.d.ts.map