/**
 * @kosService core.event-bus
 * @kosApiLevel 2
 */
export interface ApiCallback<T = string> {
    headers: Record<string, string>;
    body: T;
}
/**
 * @kosService core.event-bus
 */
export type EventCallback<T = ApiCallback> = (msg?: T) => void;
/**
 * @kosService core.event-bus
 * @kosApiLevel 2
 */
export interface PublishResponse {
    eventType: string;
    subscribers: number;
}
/**
 * @kosService core.event-bus
 * @kosApiLevel 7
 */
export declare function hasEventSubscriptions(eventType: string): boolean;
/**
 * Subscribes to a specific event type with a callback function.
 *
 * @template T - The type of the callback function, defaults to `ApiCallback`.
 *
 * @param eventType - The name of the event to subscribe to.
 * @param callback - The callback function to execute when the event is triggered.
 *
 * @returns An object containing:
 * - `count`: The number of active subscriptions for the event type.
 * - `unsubscribe`: A function to unsubscribe from the event, which also returns the updated subscription count.
 *
 * @kosService core.event-bus
 * @kosApiLevel 2
 */
export declare function subscribe<T = ApiCallback>(eventType: string, callback: EventCallback<T>): {
    count: number;
    unsubscribe: () => {
        count: number;
    };
};
/**
 * Publishes an event to all subscribers of the specified event type.
 *
 * @param eventType - The type of the event to publish.
 * @param msg - The message payload to send to subscribers.
 * @param headers - Optional headers to include with the event. If the "sync" header is provided,
 *                  the event will be published synchronously, and the response will be sent back
 *                  to the source using the specified sync ID.
 * @returns An object containing the event type and the number of subscribers the event was published to.
 *
 * The function checks if there are any subscriptions for the given event type. If no subscriptions
 * exist, it logs a debug message and returns an object indicating zero subscribers. Otherwise, it
 * iterates over the subscribers and publishes the event:
 * - If the "sync" header is present, the function waits for a response from the subscriber and
 *   publishes the response back to the source using the sync ID.
 * - If the "sync" header is not present, the event is published asynchronously in a fire-and-forget manner.
 *
 * @kosService core.event-bus
 * @kosApiLevel 2
 */
export declare function publish(eventType: string, msg: unknown, headers?: Record<string, string>): PublishResponse;
/**
 * Resets the event bus by clearing all existing subscriptions.
 * Logs a warning message indicating the reset operation.
 *
 * @remarks
 * This function iterates through all keys in the `subscriptions` object
 * and deletes them, effectively removing all event listeners.
 *
 * @example
 * ```typescript
 * reset(); // Clears all event subscriptions and logs a warning.
 * ```
 *
 * @kosService core.event-bus
 * @kosApiLevel 2
 */
export declare function reset(): void;
/**
 * Subscribe to an event that will automatically unsubscribe after the first occurrence
 *
 * @param eventType - The event type to listen for
 * @param callback - The callback to execute once
 * @returns Unsubscribe function
 *
 * @kosService core.event-bus
 * @kosApiLevel 11
 */
export declare function once<T = ApiCallback>(eventType: string, callback: EventCallback<T>): () => void;
/**
 * Wait for a specific event to occur, returning a Promise
 *
 * @param eventType - The event type to wait for
 * @param timeout - Optional timeout in milliseconds
 * @returns Promise that resolves with the event data
 *
 * @kosService core.event-bus
 * @kosApiLevel 11
 */
export declare function waitFor<T = ApiCallback>(eventType: string, timeout?: number): Promise<T>;
//# sourceMappingURL=eventBus.d.ts.map