/**
 * Event Bus Mediator Implementation
 *
 * This module implements the Mediator pattern for decoupled event-driven
 * communication between resources. The mediator is a singleton within
 * each infrastructure context.
 *
 * @module declarative-api/event-bus-mediator
 */
import type { IBaseEvent, IEventBusMediator, EventHandler, RequestHandler, Subscription, EventLogEntry, ISpecification } from '../../../lib/runtime-web/types/declarative-api';
/**
 * Error thrown when no request handler is registered.
 */
export declare class NoRequestHandlerError extends Error {
    readonly requestType: string;
    readonly code = "NO_REQUEST_HANDLER";
    constructor(requestType: string);
}
/**
 * Error thrown when a request handler is already registered.
 */
export declare class RequestHandlerAlreadyRegisteredError extends Error {
    readonly requestType: string;
    readonly code = "REQUEST_HANDLER_ALREADY_REGISTERED";
    constructor(requestType: string);
}
/**
 * Event Bus Mediator implementation.
 *
 * Implements the Mediator pattern for decoupled event-driven communication.
 * Supports pub/sub with filtering and request/response patterns.
 *
 * Validates: Requirements 14.1, 14.2, 14.3, 14.4, 14.5, 14.6
 */
export declare class EventBusMediator implements IEventBusMediator {
    /** Map of event type to subscriptions */
    private readonly subscriptions;
    /** Map of request type to handler */
    private readonly requestHandlers;
    /** Event log for debugging */
    private readonly eventLog;
    /** Maximum event log size */
    private readonly maxLogSize;
    /** Counter for generating unique subscription IDs */
    private subscriptionCounter;
    /** Singleton instances per context ID */
    private static readonly instances;
    /**
     * Create a new EventBusMediator.
     *
     * @param maxLogSize - Maximum number of log entries to keep (default: 1000)
     */
    constructor(maxLogSize?: number);
    /**
     * Get or create a singleton instance for a context.
     *
     * @param contextId - The context identifier
     * @param maxLogSize - Maximum log size for new instances
     * @returns The singleton instance for the context
     */
    static getInstance(contextId: string, maxLogSize?: number): EventBusMediator;
    /**
     * Clear a singleton instance for a context.
     *
     * @param contextId - The context identifier
     * @returns True if an instance was cleared
     */
    static clearInstance(contextId: string): boolean;
    /**
     * Clear all singleton instances.
     */
    static clearAllInstances(): void;
    /** @inheritdoc */
    publish<T extends IBaseEvent>(event: T): void;
    /** @inheritdoc */
    publishAsync<T extends IBaseEvent>(event: T): Promise<void>;
    /** @inheritdoc */
    subscribe<T extends IBaseEvent>(eventType: T['type'], handler: EventHandler<T>): Subscription;
    /** @inheritdoc */
    subscribeWithFilter<T extends IBaseEvent>(eventType: T['type'], handler: EventHandler<T>, filter: ISpecification<T>): Subscription;
    /** @inheritdoc */
    request<TRequest, TResponse>(requestType: string, request: TRequest): Promise<TResponse>;
    /** @inheritdoc */
    registerRequestHandler<TRequest, TResponse>(requestType: string, handler: RequestHandler<TRequest, TResponse>): void;
    /** @inheritdoc */
    unregisterRequestHandler(requestType: string): boolean;
    /** @inheritdoc */
    getEventLog(limit?: number): readonly EventLogEntry[];
    /** @inheritdoc */
    clearEventLog(): void;
    /** @inheritdoc */
    getSubscriberCount(eventType: string): number;
    /** @inheritdoc */
    hasRequestHandler(requestType: string): boolean;
    /**
     * Add a subscription entry.
     *
     * @param eventType - The event type
     * @param handler - The handler function
     * @param filter - Optional filter specification
     * @returns Subscription handle
     */
    private addSubscription;
    /**
     * Remove a subscription by ID.
     *
     * @param eventType - The event type
     * @param subscriptionId - The subscription ID
     */
    private removeSubscription;
    /**
     * Log an event publication.
     *
     * @param eventType - The event type
     * @param handlerCount - Number of handlers invoked
     * @param success - Whether all handlers succeeded
     * @param error - Error message if any
     */
    private logEvent;
}
