import { MicroserviceBundle } from '../../../core/runtime-web/bundle/microservice-bundle';
import type { MicroserviceDefinition } from '../../../lib/runtime-web/types/microservice.types';
import type { RuntimeAwakeSettings } from '../../../lib/runtime-web/runtime-awake/config.types';
/**
 * Error class for handler resolution failures.
 */
export declare class HandlerResolutionError extends Error {
    readonly microserviceName: string;
    readonly handlerHashKey: string;
    readonly cause?: Error | undefined;
    constructor(microserviceName: string, handlerHashKey: string, message: string, cause?: Error | undefined);
}
/**
 * Resolved handler information.
 */
export interface ResolvedHandler {
    /** The bound handler function */
    readonly handler: Function;
    /** Microservice name */
    readonly microserviceName: string;
    /** Handler hash key */
    readonly handlerHashKey: string;
    /** Handler name (for debugging) */
    readonly handlerName: string;
    /** The MicroserviceBundle instance */
    readonly bundle: MicroserviceBundle;
}
/**
 * Handler resolver configuration.
 */
export interface HandlerResolverConfig {
    /** Microservices enabled for Live Dev */
    readonly microservices: Record<string, MicroserviceDefinition>;
}
/**
 * Local Handler Resolver for Awake Lambda Development.
 *
 * Creates MicroserviceBundle instances from configuration and resolves
 * handlers using hash keys. Provides full DI container support with
 * typed `event.ties` for local execution.
 *
 * @see Requirements 4.6, 12.6
 *
 * @example
 * ```typescript
 * const resolver = new LocalHandlerResolver({
 *   microservices: {
 *     payments: paymentsService,
 *     users: usersService,
 *   },
 * });
 *
 * const { handler, handlerName } = resolver.resolveHandler('payments', 'a1b2c3d4');
 * const result = await handler(event, context);
 * ```
 */
export declare class LocalHandlerResolver {
    /** Map of microservice name to MicroserviceBundle */
    private readonly bundles;
    /** Configuration */
    private readonly config;
    /** Initialization timestamp */
    private readonly initializationTime;
    /**
     * Create a new LocalHandlerResolver.
     *
     * @param config - Handler resolver configuration
     */
    constructor(config: HandlerResolverConfig);
    /**
     * Initialize MicroserviceBundle instances from configuration.
     *
     * Creates a PureContainer and MicroserviceBundle for each configured
     * microservice. Bundles are cached for reuse across handler invocations.
     *
     * @private
     */
    private initializeBundles;
    /**
     * Resolve a handler by microservice name and hash key.
     *
     * Uses MicroserviceBundle.getHandlerByHash() to resolve the handler by hash key.
     * This matches how Lambda handlers resolve in production - by hash key computed
     * via hash32Base64Url(handler.toString()).
     *
     * The handler is pre-bound with DI dependencies and ready for execution.
     *
     * @param microserviceName - Name of the microservice (e.g., 'payments')
     * @param handlerHashKey - Handler hash key computed via hash32Base64Url
     * @returns Resolved handler information
     * @throws HandlerResolutionError if handler not found
     *
     * @see Requirements 4.6
     */
    resolveHandler(microserviceName: string, handlerHashKey: string): ResolvedHandler;
    /**
     * Check if a handler exists for the given microservice and hash key.
     *
     * @param microserviceName - Name of the microservice
     * @param handlerHashKey - Handler hash key
     * @returns True if handler exists
     */
    hasHandler(microserviceName: string, handlerHashKey: string): boolean;
    /**
     * Get the MicroserviceBundle for a microservice.
     *
     * @param microserviceName - Name of the microservice
     * @returns MicroserviceBundle or undefined if not found
     */
    getBundle(microserviceName: string): MicroserviceBundle | undefined;
    /**
     * Get all available microservice names.
     *
     * @returns Array of microservice names
     */
    getMicroserviceNames(): string[];
    /**
     * Get all available handler hash keys for a microservice.
     *
     * @param microserviceName - Name of the microservice
     * @returns Array of handler hash keys or empty array if microservice not found
     */
    getHandlerHashKeys(microserviceName: string): string[];
    /**
     * Get diagnostic information about the resolver.
     *
     * @returns Diagnostic information
     */
    getDiagnostics(): {
        microserviceCount: number;
        totalHandlerCount: number;
        microservices: Array<{
            name: string;
            handlerCount: number;
            handlers: Array<{
                hashKey: string;
                name: string;
            }>;
        }>;
        initializationTimeMs: number;
    };
    /**
     * Reload a specific microservice bundle.
     *
     * Recreates the MicroserviceBundle for the specified microservice,
     * clearing the Node.js require cache for fresh module loading.
     *
     * @param microserviceName - Name of the microservice to reload
     * @throws HandlerResolutionError if microservice not configured
     *
     * @see Requirements 5.4, 5.5
     */
    reloadMicroservice(microserviceName: string): void;
    /**
     * Reload all microservice bundles.
     *
     * Recreates all MicroserviceBundle instances for hot reload support.
     *
     * @see Requirements 5.4, 5.5
     */
    reloadAll(): void;
    /**
     * Compute handler hash key from handler code.
     *
     * Utility method to compute the hash key for a handler function.
     * Uses the same algorithm as MicroserviceBundle for consistency.
     *
     * @param handlerCode - Handler function code as string
     * @returns Hash key (32-character Base64 URL-safe string)
     */
    static computeHandlerHashKey(handlerCode: string): string;
    /**
     * Create a LocalHandlerResolver from RuntimeAwakeSettings.
     *
     * Factory method to create a resolver from Live Dev configuration.
     *
     * @param settings - Live Dev settings
     * @returns LocalHandlerResolver instance
     */
    static fromRuntimeAwakeSettings(settings: RuntimeAwakeSettings): LocalHandlerResolver;
}
