'use strict';
const EventEmitter = require('events');

class WalleEventBus extends EventEmitter {
  constructor() {
    super();
    this.setMaxListeners(20);
  }

  emitMessage(channel, text, sender) {
    this.emit('message', { channel, text, sender, ts: Date.now() });
  }

  emitHighImportance(memoryId, content) {
    this.emit('high_importance', { memoryId, content, ts: Date.now() });
  }

  emitWebhook(source, payload) {
    this.emit('webhook', { source, payload, ts: Date.now() });
  }
}

module.exports = new WalleEventBus();
