import type { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
/**
 * Protocol version for Live Dev messages.
 * Used for compatibility checking between Proxy Lambda and Local CLI.
 */
export type RuntimeAwakeProtocolVersion = '1.0';
/**
 * S3 reference for payloads exceeding 128KB MQTT limit.
 *
 * When request or response payloads exceed the IoT Core message size limit,
 * the payload is stored in S3 and this reference is included in the MQTT message.
 *
 * @example
 * ```typescript
 * const ref: S3PayloadReference = {
 *   type: 's3-reference',
 *   bucket: 'my-app-dev-runtime-awake-payloads',
 *   key: 'dev123/req-456/payload',
 *   presignedUrl: 'https://...'
 * };
 * ```
 */
export interface S3PayloadReference {
    /** Discriminator for type narrowing */
    readonly type: 's3-reference';
    /** S3 bucket name */
    readonly bucket: string;
    /** S3 object key */
    readonly key: string;
    /** Pre-signed URL for download (valid 15 minutes) */
    readonly presignedUrl: string;
}
/**
 * Lambda context information passed to local handler.
 *
 * Contains all fields required by AWS Lambda's Context interface
 * to ensure runtime parity between cloud and local execution.
 *
 * @see Requirements 8.3, 8.4
 */
export interface RuntimeAwakeContext {
    /** Lambda function name */
    readonly functionName: string;
    /** Lambda function version */
    readonly functionVersion: string;
    /** Full ARN of the invoked function */
    readonly invokedFunctionArn: string;
    /** Memory limit in MB */
    readonly memoryLimitInMB: number;
    /** AWS request ID for correlation */
    readonly awsRequestId: string;
    /** CloudWatch log group name */
    readonly logGroupName: string;
    /** CloudWatch log stream name */
    readonly logStreamName: string;
}
/**
 * Base message interface with correlation ID.
 *
 * All Live Dev messages include a unique requestId for correlation
 * and idempotency across cloud and local components.
 *
 * @see Requirements 2.4
 */
export interface RuntimeAwakeMessage {
    /** Unique request identifier for correlation (UUID v4) */
    readonly requestId: string;
    /** ISO timestamp of message creation */
    readonly timestamp: string;
    /** Protocol version for compatibility */
    readonly protocolVersion: RuntimeAwakeProtocolVersion;
}
/**
 * Request message from Proxy Lambda to Local CLI.
 *
 * Published to IoT Core topic: `runtime/dev/<devId>/request/<requestId>`
 *
 * Contains the original Lambda event, context, and handler identification
 * for the Local CLI to resolve and execute the appropriate handler.
 *
 * @see Requirements 2.1, 2.2
 *
 * @example
 * ```typescript
 * const request: RuntimeAwakeRequest = {
 *   requestId: 'abc-123',
 *   timestamp: '2025-01-14T10:00:00.000Z',
 *   protocolVersion: '1.0',
 *   type: 'request',
 *   microserviceName: 'payments',
 *   handlerHashKey: 'a1b2c3d4',
 *   lambdaId: 'charge',
 *   event: { httpMethod: 'POST', ... },
 *   context: { functionName: 'payments-charge', ... },
 *   remainingTimeMs: 25000
 * };
 * ```
 */
export interface RuntimeAwakeRequest extends RuntimeAwakeMessage {
    /** Message type discriminator */
    readonly type: 'request';
    /** Microservice name (e.g., 'payments', 'users') */
    readonly microserviceName: string;
    /** Handler hash key (computed via hash32Base64Url) */
    readonly handlerHashKey: string;
    /** Lambda ID for debugging (e.g., 'charge', 'get-user') */
    readonly lambdaId: string;
    /** Original Lambda event (or S3 reference if large) */
    readonly event: APIGatewayProxyEvent | S3PayloadReference;
    /** Lambda context information */
    readonly context: RuntimeAwakeContext;
    /** Remaining time in milliseconds when request was sent */
    readonly remainingTimeMs: number;
}
/**
 * Success response from Local CLI to Proxy Lambda.
 *
 * Published to IoT Core topic: `runtime/dev/<devId>/response/<requestId>`
 *
 * Contains the handler's return value and execution metrics.
 *
 * @see Requirements 4.8
 */
export interface RuntimeAwakeSuccessResponse extends RuntimeAwakeMessage {
    /** Message type discriminator */
    readonly type: 'response';
    /** Response status discriminator */
    readonly status: 'success';
    /** Handler return value (or S3 reference if large) */
    readonly result: APIGatewayProxyResult | S3PayloadReference;
    /** Execution duration in milliseconds */
    readonly durationMs: number;
}
/**
 * Error details structure for error responses.
 */
export interface RuntimeAwakeErrorDetails {
    /** Error type/class name (e.g., 'ValidationError', 'Error') */
    readonly errorType: string;
    /** Error message */
    readonly errorMessage: string;
    /** Stack trace as array of frame strings */
    readonly stackTrace: string[];
}
/**
 * Error response from Local CLI to Proxy Lambda.
 *
 * Published to IoT Core topic: `runtime/dev/<devId>/response/<requestId>`
 *
 * Contains error details including type, message, and stack trace
 * for debugging purposes.
 *
 * @see Requirements 17.1, 17.2
 */
export interface RuntimeAwakeErrorResponse extends RuntimeAwakeMessage {
    /** Message type discriminator */
    readonly type: 'response';
    /** Response status discriminator */
    readonly status: 'error';
    /** Error details */
    readonly error: RuntimeAwakeErrorDetails;
    /** Execution duration in milliseconds */
    readonly durationMs: number;
}
/**
 * Union type for all response types.
 */
export type RuntimeAwakeResponse = RuntimeAwakeSuccessResponse | RuntimeAwakeErrorResponse;
/**
 * Type guard to check if a payload is an S3 reference.
 *
 * @param payload - The payload to check
 * @returns True if the payload is an S3PayloadReference
 *
 * @example
 * ```typescript
 * if (isS3PayloadReference(request.event)) {
 *   const actualEvent = await downloadFromS3(request.event);
 * }
 * ```
 */
export declare function isS3PayloadReference(payload: unknown): payload is S3PayloadReference;
/**
 * Type guard to check if a response is a success response.
 *
 * @param response - The response to check
 * @returns True if the response is a RuntimeAwakeSuccessResponse
 */
export declare function isSuccessResponse(response: RuntimeAwakeResponse): response is RuntimeAwakeSuccessResponse;
/**
 * Type guard to check if a response is an error response.
 *
 * @param response - The response to check
 * @returns True if the response is a RuntimeAwakeErrorResponse
 */
export declare function isErrorResponse(response: RuntimeAwakeResponse): response is RuntimeAwakeErrorResponse;
