use super::registry::HookRegistry;
use super::types::{Hook, HookAction, HookEvent};
use anyhow::Result;
use std::sync::Arc;
pub struct SystemHooks;
impl SystemHooks {
pub async fn register(registry: &HookRegistry) -> Result<()> {
registry.register(Hook::new(
HookEvent::SystemStart,
Arc::from("system_start_log"),
0,
HookAction::Log(Arc::from("System starting...")),
)).await?;
registry.register(Hook::new(
HookEvent::SystemStop,
Arc::from("system_stop_log"),
0,
HookAction::Log(Arc::from("System stopping...")),
)).await?;
registry.register(Hook::new(
HookEvent::ConfigLoaded,
Arc::from("config_loaded_log"),
0,
HookAction::Log(Arc::from("Configuration loaded")),
)).await?;
registry.register(Hook::new(
HookEvent::GatewayStart,
Arc::from("gateway_start_log"),
0,
HookAction::Log(Arc::from("Gateway started")),
)).await?;
registry.register(Hook::new(
HookEvent::AgentCreate,
Arc::from("agent_create_log"),
10,
HookAction::Log(Arc::from("Agent created")),
)).await?;
registry.register(Hook::new(
HookEvent::AgentDestroy,
Arc::from("agent_destroy_log"),
10,
HookAction::Log(Arc::from("Agent destroyed")),
)).await?;
registry.register(Hook::new(
HookEvent::MessageReceived,
Arc::from("message_received_log"),
20,
HookAction::Log(Arc::from("Message received")),
)).await?;
tracing::info!("System hooks registered");
Ok(())
}
}