import type { RuntimeAwakeRequest, RuntimeAwakeResponse } from '../../../lib/runtime-web/runtime-awake';
/**
 * Connection state for the MQTT client.
 */
export type MqttConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
/**
 * Configuration for the Local CLI MQTT client.
 *
 * @see Requirements 12.2
 */
export interface LocalMqttClientConfig {
    /** AWS IoT Core endpoint */
    readonly iotEndpoint: string;
    /** AWS region */
    readonly region: string;
    /** AWS profile (optional) */
    readonly profile?: string;
    /** Developer ID for topic isolation */
    readonly devId: string;
    /** QoS level for messages (default: 1) */
    readonly qos?: 0 | 1;
    /** Initial reconnection delay in ms (default: 1000) */
    readonly initialReconnectDelayMs?: number;
    /** Maximum reconnection delay in ms (default: 30000) */
    readonly maxReconnectDelayMs?: number;
    /** Message idempotency TTL in ms (default: 300000 = 5 minutes) */
    readonly idempotencyTtlMs?: number;
}
/**
 * Message handler callback for incoming requests.
 */
export type RequestMessageHandler = (request: RuntimeAwakeRequest) => Promise<void>;
/**
 * Connection state change handler.
 */
export type ConnectionStateHandler = (state: MqttConnectionState, error?: Error) => void;
/**
 * Calculate exponential backoff delay.
 *
 * Implements the formula: delay(n) = min(initialDelay * 2^n, maxDelay)
 *
 * @param attempt - Current attempt number (0-indexed)
 * @param initialDelayMs - Initial delay in milliseconds
 * @param maxDelayMs - Maximum delay in milliseconds
 * @returns Delay in milliseconds
 *
 * @see Requirements 4.5, 11.2
 */
export declare function calculateBackoffDelay(attempt: number, initialDelayMs?: number, maxDelayMs?: number): number;
/**
 * Check if a host should bypass proxy based on NO_PROXY environment variable.
 *
 * @param host - Host to check
 * @param noProxy - NO_PROXY value (comma-separated list of hosts)
 * @returns True if host should bypass proxy
 */
export declare function shouldBypassProxy(host: string, noProxy?: string): boolean;
/**
 * Get proxy configuration from environment variables.
 *
 * Respects HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables.
 *
 * @param targetHost - Target host to connect to
 * @returns Proxy URL or undefined if no proxy should be used
 *
 * @see Requirements 4.3, 11.1
 */
export declare function getProxyConfig(targetHost: string): string | undefined;
/**
 * Local CLI MQTT Client for Awake Lambda Development.
 *
 * Connects to AWS IoT Core via MQTT over WebSockets with SigV4 authentication.
 * Provides automatic reconnection with exponential backoff and message idempotency.
 *
 * Note: This implementation uses the AWS SDK IoT Data Plane client for publishing
 * and a polling-based approach for receiving messages. For production use with
 * real-time subscriptions, consider using aws-iot-device-sdk-v2.
 *
 * @see Requirements 2.1, 4.2, 4.3, 4.4, 4.5
 */
export declare class LocalMqttClient {
    private readonly config;
    private readonly iotClient;
    private readonly qos;
    private readonly initialReconnectDelayMs;
    private readonly maxReconnectDelayMs;
    private readonly idempotencyTtlMs;
    /** Current connection state */
    private connectionState;
    /** Current reconnection attempt count */
    private reconnectAttempt;
    /** Reconnection timer */
    private reconnectTimer;
    /** Idempotency tracking map */
    private readonly processedRequests;
    /** Idempotency cleanup timer */
    private idempotencyCleanupTimer;
    /** Message handler for incoming requests */
    private messageHandler;
    /** Connection state change handler */
    private stateHandler;
    /** Subscribed topics */
    private readonly subscribedTopics;
    /** Flag to indicate if client should be running */
    private isRunning;
    /**
     * Create a new Local MQTT client.
     *
     * @param config - Client configuration
     */
    constructor(config: LocalMqttClientConfig);
    /**
     * Get the current connection state.
     *
     * @returns Current connection state
     */
    getConnectionState(): MqttConnectionState;
    /**
     * Get the developer ID.
     *
     * @returns Developer ID
     */
    getDevId(): string;
    /**
     * Get the request topic pattern for this developer.
     *
     * @returns Request topic pattern (e.g., 'runtime/dev/john.doe/request/#')
     */
    getRequestTopicPattern(): string;
    /**
     * Get the response topic for a specific request.
     *
     * @param requestId - Request ID
     * @returns Response topic
     */
    getResponseTopic(requestId: string): string;
    /**
     * Set the message handler for incoming requests.
     *
     * @param handler - Message handler callback
     */
    onMessage(handler: RequestMessageHandler): void;
    /**
     * Set the connection state change handler.
     *
     * @param handler - State change handler callback
     */
    onStateChange(handler: ConnectionStateHandler): void;
    /**
     * Connect to AWS IoT Core.
     *
     * Establishes connection and subscribes to the request topic.
     *
     * @returns Promise that resolves when connected
     *
     * @see Requirements 4.2
     */
    connect(): Promise<void>;
    /**
     * Disconnect from AWS IoT Core.
     *
     * @returns Promise that resolves when disconnected
     */
    disconnect(): Promise<void>;
    /**
     * Subscribe to a topic.
     *
     * @param topic - Topic pattern to subscribe to
     *
     * @see Requirements 4.4
     */
    subscribe(topic: string): Promise<void>;
    /**
     * Publish a response message.
     *
     * @param requestId - Request ID for the response
     * @param response - Response message
     *
     * @see Requirements 4.8
     */
    publishResponse(requestId: string, response: RuntimeAwakeResponse): Promise<void>;
    /**
     * Check if a request has already been processed (idempotency check).
     *
     * @param requestId - Request ID to check
     * @returns True if request was already processed
     *
     * @see Requirements 2.5
     */
    isRequestProcessed(requestId: string): boolean;
    /**
     * Mark a request as processed for idempotency tracking.
     *
     * @param requestId - Request ID to mark as processed
     *
     * @see Requirements 2.5
     */
    markRequestProcessed(requestId: string): void;
    /**
     * Get the number of processed requests being tracked.
     *
     * @returns Number of tracked requests
     */
    getProcessedRequestCount(): number;
    /**
     * Handle an incoming message.
     *
     * Performs idempotency check and invokes the message handler.
     *
     * @param topic - Message topic
     * @param payload - Message payload
     *
     * @see Requirements 2.5
     */
    handleMessage(topic: string, payload: Buffer): Promise<void>;
    /**
     * Trigger reconnection with exponential backoff.
     *
     * Called when connection is lost or fails.
     *
     * @see Requirements 4.5, 11.2, 11.3, 11.4
     */
    scheduleReconnect(): void;
    /**
     * Attempt to reconnect.
     *
     * Re-establishes connection and re-subscribes to topics.
     *
     * @see Requirements 11.3
     */
    private reconnect;
    /**
     * Verify connection by testing IoT client.
     */
    private verifyConnection;
    /**
     * Set connection state and notify handler.
     *
     * @param state - New connection state
     * @param error - Optional error
     */
    private setConnectionState;
    /**
     * Start the idempotency cleanup timer.
     *
     * Periodically removes expired entries from the processed requests map.
     */
    private startIdempotencyCleanup;
    /**
     * Clean up expired processed request entries.
     *
     * Removes entries older than the idempotency TTL.
     */
    private cleanupProcessedRequests;
    /**
     * Simulate connection loss for testing.
     *
     * Triggers the reconnection logic.
     */
    simulateConnectionLoss(): void;
}
