import type { PureContainer } from '@worktif/utils';
import type { LambdaPipeline } from '../pipelines/lambda-pipeline';
import { RuntimeThreads } from '../../../lib/runtime.types';
/**
 * Diagnostic information about the runtime bundle state.
 *
 * Provides comprehensive information about bundle initialization,
 * service registration, and Lambda handler availability for troubleshooting.
 * Enhanced with object-based ties support diagnostics.
 */
export interface BundleDiagnostics {
    /** Whether the container has been fully initialized */
    containerInitialized: boolean;
    /** Total number of services registered in the container */
    serviceCount: number;
    /** Total number of Lambda handlers available */
    lambdaCount: number;
    /** Time taken for bundle initialization in milliseconds */
    initializationTime: number;
    /** List of all available service names/keys */
    availableServices: string[];
    /** List of all available Lambda handler IDs */
    availableLambdas: string[];
    /** Bundle version information */
    version?: string;
    /** Build timestamp */
    buildTime?: number;
    /** Hash algorithm used for dependency keys */
    hashAlgorithm?: string;
    /** Number of Lambda handlers using object-based ties (enhanced DI pattern) */
    objectBasedTiesCount?: number;
    /** Whether enhanced DI pattern is active in this bundle */
    enhancedDiPattern?: boolean;
    /** Whether meaningful keys are being used instead of hashes */
    meaningfulKeys?: boolean;
    /** Whether TypeScript type safety is available for dependencies */
    typeScriptSupport?: boolean;
    /** Migration status: 'legacy-only', 'modern-only', 'mixed-migration', 'no-ties', 'unknown', 'error' */
    migrationStatus?: string;
}
/**
 * Lambda Layer Bundle Interface for Runtime Web Core.
 *
 * Provides well-defined exports from Lambda Layer that generated handlers
 * can reliably import and use. Ensures all dependencies are available
 * before any handler executes.
 *
 * **Requirements**: 5.1, 6.1, 15.1
 *
 * **Usage**:
 * ```typescript
 * // In generated Lambda handler
 * const { runtimeBundle } = require('/opt/nodejs/bundle');
 *
 * const container = runtimeBundle.getContainer();
 * const pipeline = runtimeBundle.getPipeline();
 * const handler = runtimeBundle.getHandler('payments.charge');
 * ```
 */
export interface RuntimeBundle {
    /**
     * Get the shared container instance.
     *
     * Returns the fully initialized DI container that contains all
     * registered services from core pipeline and microservices.
     *
     * **Requirements**: 5.3
     *
     * @returns Fully initialized shared container instance
     * @throws Error if container is not initialized
     */
    getContainer(): PureContainer<string>;
    /**
     * Get the Lambda pipeline instance.
     *
     * Returns the Lambda pipeline instance that has access to the
     * shared container and can execute Lambda handlers.
     *
     * **Requirements**: 5.4
     *
     * @returns Lambda pipeline instance with container access
     * @throws Error if pipeline is not initialized
     */
    getPipeline(): LambdaPipeline;
    /**
     * Get bound handler for specific Lambda ID.
     *
     * Returns a bound handler function for the specified Lambda ID
     * that has all dependencies injected and is ready for execution.
     *
     * **Requirements**: 5.5
     *
     * @param runtimeThreadsOrLambdaId - RuntimeThreads object OR Lambda ID for backward compatibility
     * @param lambdaId - Lambda ID (e.g., 'payments.charge') - optional if first arg is Lambda ID
     * @returns Bound handler function ready for AWS Lambda runtime
     * @throws Error if Lambda ID not found or handler creation fails
     */
    getHandler(runtimeThreadsOrLambdaId: RuntimeThreads | string, lambdaId?: string): Promise<any> | any;
    /**
     * Validate bundle completeness.
     *
     * Validates that all expected exports are present and functional.
     * Ensures container is initialized, pipeline is available, and
     * all registered Lambda handlers can be created.
     *
     * **Requirements**: 15.1, 15.6
     *
     * @throws Error if bundle validation fails
     */
    validateBundle(): void;
    /**
     * Get diagnostic information.
     *
     * Returns comprehensive diagnostic information about bundle state,
     * service registration, and Lambda handler availability for
     * troubleshooting and monitoring.
     *
     * **Requirements**: 15.4
     *
     * @returns Bundle diagnostic information
     */
    getDiagnostics(): BundleDiagnostics;
}
/**
 * Bundle export structure for Lambda Layer.
 *
 * Defines the complete export structure that will be available
 * at `/opt/nodejs/bundle` in the Lambda Layer.
 *
 * **Requirements**: 5.1, 5.2
 */
export interface BundleExports {
    /** Main runtime bundle interface */
    runtimeBundle: RuntimeBundle;
    /** Bundle version for compatibility checking */
    version: string;
    /** Build timestamp for diagnostics */
    buildTime: number;
    /** Bundle metadata */
    metadata: {
        /** Total number of services in bundle */
        serviceCount: number;
        /** Total number of Lambda handlers in bundle */
        lambdaCount: number;
        /** Hash algorithm used for dependency keys */
        hashAlgorithm: string;
    };
}
