use once_cell::sync::Lazy;
use std::sync::Arc;
use tokio::sync::broadcast;

use super::event_bus::EventBus;
use crate::executor::ExecutorCommand;

pub enum ErrorEvent {

}

static ERROR_BUS: Lazy<Arc<EventBus<ExecutorCommand>>> =
  Lazy::new(|| Arc::new(EventBus::new()));

pub fn publish_error(event: ExecutorCommand) {
  ERROR_BUS.publish(event);
}

pub fn subscribe_error_bus() -> broadcast::Receiver<ExecutorCommand> {
  ERROR_BUS.subscribe()
}
