import eventBus, { emitEvent } from './eventBus';
import { startScheduler } from './scheduler';
import { startQueueSystem, addJob as addQueueJob } from './queue';
import { startWebSocketSystem, pushToMerchant, broadcastToAll } from './ws';

// 启动Runtime系统
const startRuntime = (): void => {
  console.log('[Runtime] Starting runtime system...');
  
  // 启动队列系统（包含Worker）
  startQueueSystem();
  
  // 启动调度器
  startScheduler();
  
  // 启动WebSocket系统
  startWebSocketSystem();
  
  console.log('[Runtime] Runtime system started successfully');
};

export {
  eventBus,
  emitEvent,
  addQueueJob,
  pushToMerchant,
  broadcastToAll,
  startRuntime
};

export default {
  eventBus,
  emitEvent,
  addQueueJob,
  pushToMerchant,
  broadcastToAll
};

