"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InMemoryDomainEventPublisher = void 0;
const events_1 = __importDefault(require("events"));
/**
 * In-memory implementation of the domain event publisher.
 *
 * This is intentionally lightweight: it runs inside the application process and
 * routes events to registered handlers. It is the infrastructure's responsibility
 * to choose a different transport (Redis, RabbitMQ, etc.) if the system needs to
 * scale beyond a single process, without changing the application interface.
 */
class InMemoryDomainEventPublisher {
    emitter = new events_1.default();
    publish(event) {
        this.emitter.emit(event.type, event);
    }
    subscribe(eventType, handler) {
        this.emitter.on(eventType, handler);
    }
}
exports.InMemoryDomainEventPublisher = InMemoryDomainEventPublisher;
//# sourceMappingURL=in-memory-event-publisher.js.map