import { PureContainer } from '@worktif/utils';
import type { LambdaDefinition, MicroserviceDefinition } from '../../../lib/runtime-web/types';
/**
 * Registry for managing PureContainer instances and Lambda-to-service mappings.
 *
 * Provides a centralized registry for storing and retrieving DI containers
 * for microservices, along with mappings between Lambda functions and their
 * parent services. This enables clean separation of concerns and makes the
 * MicroserviceRegistrar more focused on processing logic.
 *
 * @example
 * ```typescript
 * const registry = new ContainerRegistry();
 *
 * // Register a service with its container
 * registry.registerService('payments', paymentsContainer);
 *
 * // Map Lambda to service
 * registry.registerLambda('payments.charge', 'payments');
 *
 * // Retrieve container for Lambda
 * const container = registry.getContainer('payments.charge');
 * ```
 */
export declare class ContainerRegistry {
    private readonly containers;
    private readonly lambdaToMicroservice;
    private readonly lambdaDefinitions;
    private readonly microserviceDefinitions;
    /**
     * Register a service with its DI container.
     *
     * Stores the PureContainer instance for the given service name.
     * Validates that the service name is not already registered to prevent
     * accidental overwrites.
     *
     * @param microserviceName - Name of the microservice
     * @param container - PureContainer instance for the service
     * @param definition - Optional microservice definition for init support
     * @throws DIContainerError if service is already registered
     *
     * @example
     * ```typescript
     * const paymentsContainer = new PureContainer<string>();
     * registry.registerService('payments', paymentsContainer, paymentsDefinition);
     * ```
     */
    registerService(microserviceName: string, container: PureContainer<string>, definition?: MicroserviceDefinition): void;
    /**
     * Register a Lambda function with its parent service and definition.
     *
     * Creates a mapping between the Lambda ID and its parent service name,
     * and stores the Lambda definition for runtime lookup.
     * This enables looking up the correct DI container for Lambda invocations.
     *
     * @param lambdaId - Full Lambda ID (e.g., 'payments.charge')
     * @param microserviceName - Name of the parent microservice
     * @param definition - Lambda definition with handler and dependencies
     * @throws DIContainerError if Lambda is already registered
     * @throws MissingServiceError if parent service is not registered
     *
     * @example
     * ```typescript
     * registry.registerLambda('payments.charge', 'payments', chargeDefinition);
     * registry.registerLambda('payments.refund', 'payments', refundDefinition);
     * ```
     *
     * @todo: check cutting payments.charge to charge
     */
    registerLambda(lambdaId: string, microserviceName: string, definition: LambdaDefinition): void;
    /**
     * Get the DI container for a service by name.
     *
     * Retrieves the PureContainer instance for the given service name.
     *
     * @param microserviceName - Name of the microservice
     * @returns PureContainer instance for the service
     * @throws MissingServiceError if service is not registered
     *
     * @example
     * ```typescript
     * const container = registry.getContainer('payments');
     * const paymentsService = container.run('PaymentsService');
     * ```
     */
    getContainer(microserviceName: string): PureContainer<string>;
    /**
     * Get the DI container for a Lambda function.
     *
     * Looks up the parent service for the Lambda ID and returns the
     * corresponding PureContainer instance.
     *
     * @param lambdaId - Full Lambda ID (e.g., 'payments.charge')
     * @returns PureContainer instance for the Lambda's microservice
     * @throws MissingServiceError if Lambda or service is not registered
     *
     * @example
     * ```typescript
     * const container = registry.getContainerForLambda('payments.charge');
     * const paymentsService = container.run('PaymentsService');
     * ```
     */
    getContainerForLambda(lambdaId: string): PureContainer<string>;
    /**
     * Get the parent service name for a Lambda function.
     *
     * Looks up the service name that owns the given Lambda ID.
     *
     * @param lambdaId - Full Lambda ID (e.g., 'payments.charge')
     * @returns Name of the parent microservice
     * @throws MissingServiceError if Lambda is not registered
     *
     * @example
     * ```typescript
     * const serviceName = registry.getLambdaService('payments.charge');
     * console.log(serviceName); // 'payments'
     * ```
     */
    getLambdaService(lambdaId: string): string;
    /**
     * Get the Lambda definition for a Lambda function.
     *
     * Retrieves the stored Lambda definition for the given Lambda ID.
     *
     * @param lambdaId - Full Lambda ID (e.g., 'payments.charge')
     * @returns Lambda definition with handler and dependencies
     * @throws MissingServiceError if Lambda is not registered
     *
     * @example
     * ```typescript
     * const definition = registry.getLambdaDefinition('payments.charge');
     * console.log(definition.ties); // [PaymentsService, BillingService]
     * ```
     */
    getLambdaDefinition(lambdaId: string): LambdaDefinition;
    /**
     * Get the microservice definition for a service.
     *
     * Retrieves the stored microservice definition for the given service name.
     * Used for accessing microservice-level init functions.
     *
     * @param microserviceName - Name of the microservice
     * @returns Microservice definition or undefined if not stored
     *
     * @example
     * ```typescript
     * const definition = registry.getMicroserviceDefinition('payments');
     * if (definition?.init) {
     *   // Execute microservice-level init
     * }
     * ```
     */
    getMicroserviceDefinition(microserviceName: string): MicroserviceDefinition | undefined;
    /**
     * Get the microservice definition for a Lambda function.
     *
     * Looks up the parent service for the Lambda ID and returns the
     * corresponding microservice definition.
     *
     * @param lambdaId - Full Lambda ID (e.g., 'payments.charge')
     * @returns Microservice definition or undefined if not stored
     *
     * @example
     * ```typescript
     * const definition = registry.getMicroserviceDefinitionForLambda('payments.charge');
     * if (definition?.init) {
     *   // Execute microservice-level init
     * }
     * ```
     */
    getMicroserviceDefinitionForLambda(lambdaId: string): MicroserviceDefinition | undefined;
    /**
     * Check if a service is registered.
     *
     * @param serviceName - Name of the service to check
     * @returns True if service is registered
     *
     * @example
     * ```typescript
     * if (registry.hasService('payments')) {
     *   const container = registry.getContainer('payments');
     * }
     * ```
     */
    hasService(serviceName: string): boolean;
    /**
     * Check if a Lambda is registered.
     *
     * @param lambdaId - Full Lambda ID to check
     * @returns True if Lambda is registered
     *
     * @example
     * ```typescript
     * if (registry.hasLambda('payments.charge')) {
     *   const container = registry.getContainerForLambda('payments.charge');
     * }
     * ```
     */
    hasLambda(lambdaId: string): boolean;
    /**
     * Get all registered service names.
     *
     * @returns Array of service names that have been registered
     *
     * @example
     * ```typescript
     * const services = registry.getServiceNames();
     * console.log(services); // ['payments', 'users', 'notifications']
     * ```
     */
    getServiceNames(): string[];
    /**
     * Get all registered Lambda IDs.
     *
     * @returns Array of Lambda IDs that have been registered
     *
     * @example
     * ```typescript
     * const lambdas = registry.getLambdaIds();
     * console.log(lambdas); // ['payments.charge', 'payments.refund', 'users.create']
     * ```
     */
    getLambdaIds(): string[];
    /**
     * Get all Lambda IDs for a specific service.
     *
     * @param serviceName - Name of the service
     * @returns Array of Lambda IDs belonging to the service
     *
     * @example
     * ```typescript
     * const paymentLambdas = registry.getLambdasForService('payments');
     * console.log(paymentLambdas); // ['payments.charge', 'payments.refund']
     * ```
     */
    getLambdasForService(serviceName: string): string[];
    /**
     * Remove a service and all its Lambda mappings.
     *
     * Removes the service container, microservice definition, and all Lambda-to-service mappings
     * for Lambdas belonging to this service.
     *
     * @param serviceName - Name of the service to remove
     * @returns True if service was removed, false if it didn't exist
     *
     * @example
     * ```typescript
     * const removed = registry.removeService('payments');
     * console.log(removed); // true if 'payments' was registered
     * ```
     */
    removeService(serviceName: string): boolean;
    /**
     * Remove a Lambda mapping.
     *
     * Removes the Lambda-to-service mapping for the given Lambda ID.
     * Does not affect the parent service container.
     *
     * @param lambdaId - Full Lambda ID to remove
     * @returns True if Lambda was removed, false if it didn't exist
     *
     * @example
     * ```typescript
     * const removed = registry.removeLambda('payments.charge');
     * console.log(removed); // true if 'payments.charge' was registered
     * ```
     */
    removeLambda(lambdaId: string): boolean;
    /**
     * Clear all registered services and Lambda mappings.
     *
     * Removes all containers, mappings, and definitions from the registry.
     * Useful for testing or when reinitializing the registry.
     *
     * @example
     * ```typescript
     * registry.clear();
     * console.log(registry.getServiceNames()); // []
     * console.log(registry.getLambdaIds()); // []
     * ```
     */
    clear(): void;
    /**
     * Get registry statistics.
     *
     * Returns information about the current state of the registry.
     *
     * @returns Object with service, Lambda, and microservice definition counts
     *
     * @example
     * ```typescript
     * const stats = registry.getStats();
     * console.log(stats); // { services: 3, lambdas: 8, microserviceDefinitions: 3 }
     * ```
     */
    getStats(): {
        services: number;
        lambdas: number;
        microserviceDefinitions: number;
    };
}
