import { PureContainer } from '@worktif/utils';
import type { LambdaMetadata } from '../../../lib/runtime-web/types/runtime.types';
/**
 * Lambda execution pipeline for Runtime Web Core.
 *
 * Handles Lambda function execution with dependency injection and container lifecycle management.
 * Ensures the DI container is fully populated before any handler execution and validates
 * container state throughout the pipeline execution.
 *
 * **Execution Flow**:
 * 1. Verify shared container is fully populated and ready
 * 2. Validate container state and completeness
 * 3. Resolve Lambda ID from LAMBDA_ID environment variable
 * 4. Use shared container instance for dependency injection
 * 5. Create handler with hash-based dependency resolution
 * 6. Execute handler and maintain container state
 *
 * **Requirements**: REQ-06, REQ-08, 9.1, 18.1
 */
export declare class LambdaPipeline {
    /**
     * A logger instance configured for the "Runtime Web | Pipelines | Lambda Pipeline" service.
     *
     * This logger is used to log messages and track events related to the Lambda Pipeline.
     * It is initialized with a service name for identification purposes when recording logs.
     *
     * Properties:
     * - `serviceName`: Represents the name of the service associated with this logger.
     *
     * Typical use cases of this logger include error reporting, debugging information, and
     * operational logging to monitor the Lambda Pipeline's behavior.
     */
    private readonly logger;
    /**
     * An optional variable representing the microservice registrar.
     *
     * This variable holds an instance of `MicroserviceRegistrar`, which is used
     * to manage the registration and discovery of microservices within a distributed system.
     *
     * It may be undefined if no registrar is required or configured.
     *
     * @type {MicroserviceRegistrar|undefined}
     */
    private registrar?;
    /**
     * An optional property that may hold a LambdaHandlerFactory instance.
     *
     * `handlerFactory` is used to generate or provide handlers typically for AWS Lambda functions.
     * It allows custom logic to be implemented for creating or managing these handlers, enabling
     * flexibility and reusability in serverless applications.
     *
     * @type {LambdaHandlerFactory | undefined}
     */
    private handlerFactory?;
    /**
     * Container state validator for ensuring container completeness.
     *
     * Used to validate that the shared container is fully populated and ready
     * before handler execution begins.
     *
     * @type {ContainerStateValidator}
     */
    private readonly containerValidator;
    /**
     * Shared container instance used for dependency injection.
     *
     * This is the single shared container instance that must be provided
     * from the container lifecycle manager. All handlers use this same instance.
     *
     * @type {PureContainer<string> | undefined}
     */
    private sharedContainer?;
    constructor();
    /**
     * Set the shared container instance for this pipeline.
     *
     * This method must be called before execute() to provide the fully initialized
     * shared container instance from the container lifecycle manager.
     *
     * @param container - Fully initialized shared container instance
     * @throws DIContainerError if container is not properly initialized
     */
    setSharedContainer(container: PureContainer<string>): void;
    /**
     * Execute Lambda pipeline for server-side function execution.
     *
     * Processes the microservice registry with container lifecycle integration.
     * Verifies the shared container is fully populated, validates container state,
     * resolves the Lambda ID, and creates handlers with hash-based dependency resolution.
     *
     * @param runtimeThreads - Runtime configuration with microservice registry
     * @param context - Lambda environment context with metadata
     * @param lambdaInstanceId - Optional Lambda instance ID override
     * @returns Result from Lambda handler execution
     *
     * @example
     * ```typescript
     * const pipeline = new LambdaPipeline();
     * pipeline.setSharedContainer(sharedContainer);
     * const result = await pipeline.execute(runtimeThreads, {
     *   type: 'lambda',
     *   metadata: {
     *     functionName: 'my-app-payments-charge-dev',
     *     version: '$LATEST',
     *     region: 'us-east-1',
     *     memoryLimit: 1024,
     *     requestId: 'abc-123'
     *   }
     * });
     * ```
     * @note: lambda ID: `${serviceName}.${definition.id}`
     */
    execute(runtimeThreads: any, context: {
        type: 'lambda';
        metadata: LambdaMetadata;
    }, lambdaInstanceId?: string): Promise<unknown>;
    /**
     * Verify that the shared container is available and fully populated.
     *
     * Ensures the container lifecycle manager has provided a fully initialized
     * container before any handler execution begins.
     *
     * @throws DIContainerError if shared container is not available or not ready
     * @private
     */
    private verifyContainerCompleteness;
    /**
     * Validate container state for a specific Lambda function.
     *
     * Ensures the container has all required dependencies for the specified
     * Lambda and that the container state is consistent and complete.
     *
     * @param lambdaId - Lambda ID to validate dependencies for
     * @throws Error if container state is invalid or dependencies are missing
     * @private
     */
    private validateContainerStateForLambda;
    /**
     * Create Lambda handler using the shared container instance.
     *
     * Uses the shared container for dependency injection with hash-based keys
     * to ensure consistent dependency resolution across all handlers.
     *
     * @param lambdaId - Full Lambda ID
     * @returns Lambda handler instance ready for execution
     * @throws Error if handler creation fails
     * @private
     */
    private createHandlerWithSharedContainer;
    /**
     * Maintain container state for subsequent invocations.
     *
     * Ensures the shared container state is preserved and remains consistent
     * across multiple Lambda invocations in the same container instance.
     *
     * @private
     */
    private maintainContainerState;
    /**
     * Initialize the microservice registrar and process all services.
     *
     * Creates a new MicroserviceRegistrar and processes all microservice
     * definitions from the configuration. When using shared container approach,
     * this is primarily for Lambda definition lookup rather than container creation.
     *
     * @param config - Runtime configuration with register
     * @private
     */
    private initializeRegistrar;
    /**
    }
  
    /**
     * Resolve Lambda ID from environment variables.
     *
     * Gets the Lambda ID from the LAMBDA_ID environment variable that
     * is set by the CDK stack during deployment.
     *
     * @returns Lambda ID (e.g., 'payments.charge')
     * @throws Error if LAMBDA_ID environment variable is not set
     * @private
     */
    private resolveLambdaId;
    /**
     * Find Lambda definition by ID from the processed microservices.
     *
     * Uses the MicroserviceRegistrar to retrieve the Lambda definition
     * that matches the specified ID.
     *
     * @param lambdaId - Full Lambda ID to find
     * @returns Lambda definition
     * @throws Error if Lambda definition not found
     * @private
     */
    private findLambdaDefinition;
    /**
     * Find microservice definition for a Lambda function.
     *
     * Uses the MicroserviceRegistrar to retrieve the microservice definition
     * for the Lambda's parent service. Used for microservice-level init support.
     *
     * @param lambdaId - Full Lambda ID to find microservice for
     * @returns Microservice definition or undefined if not found
     * @private
     */
    private findMicroserviceDefinitionForLambda;
}
