import { EventEmitter } from "../event-emitter.js";
class CollectionEventsManager extends EventEmitter {
  constructor() {
    super();
  }
  setDeps(deps) {
    this.collection = deps.collection;
  }
  /**
   * Emit an event to all listeners
   * Public API for emitting collection events
   */
  emit(event, eventPayload) {
    this.emitInner(event, eventPayload);
  }
  emitStatusChange(status, previousStatus) {
    this.emit(`status:change`, {
      type: `status:change`,
      collection: this.collection,
      previousStatus,
      status
    });
    const eventKey = `status:${status}`;
    this.emit(eventKey, {
      type: eventKey,
      collection: this.collection,
      previousStatus,
      status
    });
  }
  emitSubscribersChange(subscriberCount, previousSubscriberCount) {
    this.emit(`subscribers:change`, {
      type: `subscribers:change`,
      collection: this.collection,
      previousSubscriberCount,
      subscriberCount
    });
  }
  emitIndexAdded(index) {
    this.emit(`index:added`, {
      type: `index:added`,
      collection: this.collection,
      index
    });
  }
  emitIndexRemoved(index) {
    this.emit(`index:removed`, {
      type: `index:removed`,
      collection: this.collection,
      index
    });
  }
  cleanup() {
    this.clearListeners();
  }
}
export {
  CollectionEventsManager
};
//# sourceMappingURL=events.js.map
