import { PureContainer } from '@worktif/utils';
import type { LambdaDefinition, MicroserviceDefinition } from '../../../lib/runtime-web/types';
import { ContainerRegistry } from './container-registry';
import { MicroserviceBundle } from '../bundle/microservice-bundle';
/**
 * Microservice registrar for managing DI containers and Lambda mappings.
 *
 * Processes microservice definitions to create PureContainer instances and
 * maintains mappings between Lambda functions and their parent services.
 * This enables the framework to resolve the correct DI container for each
 * Lambda invocation.
 *
 * @example
 * ```typescript
 * const registrar = new MicroserviceRegistrar();
 *
 * // Process a microservice definition
 * registrar.processService('payments', {
 *   ties: [PaymentsTies],
 *   lambdas: [chargeHandler, refundHandler]
 * });
 *
 * // Get container for a specific Lambda
 * const container = registrar.getContainerForLambda('payments.charge');
 * ```
 */
export declare class MicroserviceRegistrar {
    private readonly containerFactory;
    private readonly registry;
    constructor();
    /**
     * Process a microservice definition and create its DI container.
     *
     * Creates a PureContainer from the Ties classes and processes all Lambda
     * definitions to establish service mappings. Auto-sets the service property
     * on each Lambda definition and generates Lambda IDs.
     *
     * @throws Error if service processing fails
     *
     * @example
     * ```typescript
     * registrar.processService('payments', {
     *   ties: [PaymentsTies, BillingTies],
     *   lambdas: [
     *     {
     *       id: 'charge',
     *       ties: [PaymentsService],
     *       handler: (ties) => async (event) => { ... }
     *     }
     *   ]
     * });
     * ```
     *
     * @todo:@consider: нужно взять из контекйнера – нужный DI –> по методу получения из регистра нужного микросервиса
     *        Далеее из него мы уже берем нужные Lambda, которые внутри уже содержат весь список зависимостей
     * @param microserviceName
     * @param microserviceBundle
     * @param definition
     */
    processMicroservice(microserviceName: string, microserviceBundle: MicroserviceBundle, definition: MicroserviceDefinition): void;
    /**
     * Get the DI container for a specific Lambda function.
     *
     * Looks up the service name 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 not found
     *
     * @example
     * ```typescript
     * const container = registrar.getContainerForLambda('payments.charge');
     * const paymentsService = container.run('PaymentsService');
     * ```
     */
    getContainerForLambda(lambdaId: string): PureContainer<string>;
    /**
     * Generate a Lambda ID from service name and Lambda definition.
     *
     * Uses explicit ID if provided, otherwise extracts from handler function name.
     * The final ID format is always '{microserviceName}.{lambdaId}'.
     *
     * @param microserviceName - Name of the parent microservice
     * @param definition - Lambda definition
     * @returns Full Lambda ID
     *
     * @example
     * ```typescript
     * // With explicit ID
     * generateLambdaId('payments', { id: 'charge', ... }) // → 'payments.charge'
     *
     * // Without explicit ID (extracts from handler name)
     * generateLambdaId('payments', { handler: function processPayment() {...} }) // → 'payments.processPayment'
     * ```
     */
    generateLambdaId(microserviceName: string, definition: LambdaDefinition): string;
    /**
     * Get all registered service names.
     *
     * @returns Array of service names that have been processed
     */
    getServiceNames(): string[];
    /**
     * Get all registered Lambda IDs.
     *
     * @returns Array of Lambda IDs that have been processed
     */
    getLambdaIds(): string[];
    /**
     * Get the service name for a Lambda ID.
     *
     * @param lambdaId - Full Lambda ID
     * @returns Service name or undefined if not found
     */
    getServiceForLambda(lambdaId: string): string | undefined;
    /**
     * Check if a service is registered.
     *
     * @param serviceName - Name of the service to check
     * @returns True if service is registered
     */
    hasService(serviceName: string): boolean;
    /**
     * Check if a Lambda is registered.
     *
     * @param lambdaId - Full Lambda ID to check
     * @returns True if Lambda is registered
     */
    hasLambda(lambdaId: string): boolean;
    /**
     * Get all Lambda definitions for a service.
     *
     * @param serviceName - Name of the service
     * @returns Array of Lambda IDs for the service
     */
    getLambdasForService(serviceName: string): string[];
    /**
     * Clear all registered services and containers.
     *
     * Useful for testing or when reinitializing the registrar.
     */
    clear(): void;
    /**
     * Get Lambda definition by ID.
     *
     * Retrieves the Lambda definition for the specified Lambda ID.
     *
     * @param lambdaId - Full Lambda ID (e.g., 'payments.charge')
     * @returns Lambda definition with handler and dependencies
     * @throws Error if Lambda definition not found
     */
    getLambdaDefinition(lambdaId: string): LambdaDefinition;
    /**
     * Get microservice definition by service name.
     *
     * Retrieves the microservice definition for the specified service name.
     * Used for accessing microservice-level init functions.
     *
     * @param serviceName - Name of the microservice
     * @returns Microservice definition or undefined if not stored
     *
     * @example
     * ```typescript
     * const definition = registrar.getMicroserviceDefinition('payments');
     * if (definition?.init) {
     *   // Execute microservice-level init
     * }
     * ```
     */
    getMicroserviceDefinition(serviceName: string): MicroserviceDefinition | undefined;
    /**
     * Get 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 = registrar.getMicroserviceDefinitionForLambda('payments.charge');
     * if (definition?.init) {
     *   // Execute microservice-level init
     * }
     * ```
     */
    getMicroserviceDefinitionForLambda(lambdaId: string): MicroserviceDefinition | undefined;
    /**
     * Get the underlying container registry.
     *
     * Provides access to the internal ContainerRegistry for advanced use cases.
     *
     * @returns ContainerRegistry instance
     */
    getRegistry(): ContainerRegistry;
    /**
     * Validate a container has all required services (private helper).
     *
     * This is currently disabled but can be enabled for debugging.
     *
     * @param container - Container to validate
     * @param definition - Microservice definition
     */
    private validateContainer;
}
