import { IEventBus, DomainEvent } from './event-bus.protocol.js';
import { IEventReadPort, ListEventsQuery, EventPage } from './event-read.protocol.js';
import { EventsModuleOptions } from './events.module.js';
import '../../types/drizzle.js';
import 'drizzle-orm/node-postgres';
import '@nestjs/common';

declare class MemoryEventBus implements IEventBus, IEventReadPort {
    private readonly logger;
    /** All events published since construction (or last clear). */
    readonly publishedEvents: DomainEvent[];
    private readonly handlers;
    private readonly opts;
    constructor(opts?: EventsModuleOptions);
    publish(event: DomainEvent): Promise<void>;
    publishMany(events: DomainEvent[]): Promise<void>;
    findById(eventId: string): Promise<DomainEvent | null>;
    subscribe<T extends DomainEvent = DomainEvent>(eventType: string, handler: (event: T) => Promise<void>): () => void;
    listEvents(query?: ListEventsQuery): Promise<EventPage>;
    /** Remove all published events and subscriptions. Useful in beforeEach. */
    clear(): void;
    /** Filter published events by `metadata.pool`. */
    publishedEventsForPool(pool: string): DomainEvent[];
    /** Filter published events by `metadata.direction`. */
    publishedEventsForDirection(direction: string): DomainEvent[];
    /**
     * Decide whether `event` should be dispatched to handlers given the
     * current pool filter.
     *
     * Semantics (mirroring `DrizzleEventBus.processBatch`):
     * - `opts.pools` undefined  → dispatch everything (no filter).
     * - `opts.pools` empty array → treated as "no filter" to match the
     *   Drizzle backend, where `pools && pools.length > 0` is the gate on
     *   the `inArray` WHERE clause. Empty arrays dispatch everything.
     * - `opts.pools` non-empty  → dispatch only when `event.metadata.pool`
     *   is in the list. Events without `metadata.pool` do NOT match — they
     *   are out of all configured pools by definition.
     */
    private shouldDispatch;
    /**
     * Mirror the `domain_events_tier_routing_check` DB CHECK at the memory
     * backend (AUDIT-1). Audit-tier events MUST have null/undefined
     * `pool` and `direction` in metadata; the bridge dispatcher relies on
     * this invariant.
     */
    private assertTierRouting;
    private dispatch;
}

export { MemoryEventBus };
