import { Construct } from 'constructs';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import type { RuntimeAwakeStack } from '../../runtime-web/runtime-awake/runtime-awake-stack';
import type { RuntimeAwakeFallbackMode } from '../../../lib/runtime-web/runtime-awake';
/**
 * Properties for ProxyLambdaConstruct
 *
 * @see Requirements 7.1, 7.2, 7.3, 7.4, 7.5
 */
export interface ProxyLambdaConstructProps {
    /**
     * Original Lambda function to wrap with Live Dev proxy.
     */
    readonly originalFunction: lambda.Function;
    /**
     * Live Dev stack containing infrastructure resources.
     */
    readonly runtimeAwakeStack: RuntimeAwakeStack;
    /**
     * Fallback behavior when no active session exists.
     * - 'execute': Run the original handler in the cloud
     * - 'error': Return 503 "Live dev session not connected"
     *
     * @default 'execute'
     */
    readonly fallbackMode?: RuntimeAwakeFallbackMode;
    /**
     * Microservice name for handler resolution.
     */
    readonly microserviceName: string;
    /**
     * Handler hash key for handler resolution.
     */
    readonly handlerHashKey: string;
    /**
     * Lambda ID for debugging and logging.
     */
    readonly lambdaId: string;
    /**
     * Timeout buffer in seconds (subtracted from Lambda timeout).
     * @default 5
     */
    readonly timeoutBuffer?: number;
    /**
     * Default Dev_ID for session lookup when not provided in request.
     * Used as fallback when X-Runtime-Awake-Id header and authorizer context are not present.
     */
    readonly defaultDevId?: string;
}
/**
 * ProxyLambdaConstruct - CDK construct for wrapping Lambda functions with Live Dev proxy.
 *
 * Creates a proxy Lambda function that:
 * - Checks session registry for active developer sessions
 * - Routes requests to IoT Core for local execution
 * - Falls back to original handler when no session exists
 * - Handles large payloads via S3 indirection
 * - Uses S3 polling for response waiting (ResponseWaiter pattern)
 * - Resolves Dev_ID from header, authorizer, or environment
 * - Maps error types to appropriate HTTP status codes
 *
 * **Architecture**:
 * - Proxy Lambda intercepts all requests
 * - Checks DynamoDB for active session
 * - Publishes to IoT Core topic for local execution
 * - Polls S3 for response with configurable interval
 * - Falls back to original handler if needed
 *
 * **Requirements**: 7.1, 7.2, 7.3, 7.4, 7.5
 *
 * @example
 * ```typescript
 * const proxyConstruct = new ProxyLambdaConstruct(this, 'PaymentsChargeProxy', {
 *   originalFunction: chargeFunction,
 *   runtimeAwakeStack,
 *   fallbackMode: 'execute',
 *   microserviceName: 'payments',
 *   handlerHashKey: 'abc123',
 *   lambdaId: 'payments.charge',
 *   defaultDevId: 'john.doe',
 * });
 *
 * // Use proxyConstruct.proxyFunction instead of original
 * ```
 */
export declare class ProxyLambdaConstruct extends Construct {
    /**
     * The proxy Lambda function that wraps the original.
     */
    readonly proxyFunction: lambda.Function;
    /**
     * The original Lambda function being wrapped.
     */
    readonly originalFunction: lambda.Function;
    constructor(scope: Construct, id: string, props: ProxyLambdaConstructProps);
    /**
     * Create the proxy Lambda function.
     *
     * @param originalFunction - Original Lambda function
     * @param runtimeAwakeStack - Live Dev stack
     * @param fallbackMode - Fallback behavior
     * @param microserviceName - Microservice name
     * @param handlerHashKey - Handler hash key
     * @param lambdaId - Lambda ID
     * @param timeoutBuffer - Timeout buffer in seconds
     * @param defaultDevId - Default Dev_ID for session lookup
     * @returns Proxy Lambda function
     * @private
     */
    private createProxyFunction;
    /**
     * Grant required IAM permissions to proxy Lambda.
     *
     * Grants:
     * - DynamoDB read permissions for session registry
     * - S3 read/write permissions for large payloads
     * - Lambda invoke permission for fallback
     * - IoT permissions for MQTT publish
     *
     * @param proxyFunction - Proxy Lambda function
     * @param originalFunction - Original Lambda function
     * @param runtimeAwakeStack - Live Dev stack
     * @private
     *
     * @see Requirements 7.1
     */
    private grantPermissions;
    /**
     * Create the proxy Lambda code.
     *
     * Generates inline JavaScript code for the Lambda handler that:
     * - Integrates ResponseWaiter with S3 polling
     * - Implements Dev_ID resolution with priority order
     * - Maps error types to HTTP status codes
     * - Handles large payloads via S3 indirection
     *
     * @returns Lambda Code asset
     * @private
     *
     * @see Requirements 7.1, 7.2
     */
    private createProxyCode;
    /**
     * Generate the inline handler code.
     *
     * @returns Handler code string
     * @private
     */
    private generateHandlerCode;
    private generateHandlerCodePart1;
    private generateHandlerCodePart2;
    private generateHandlerCodePart3;
}
