use serde_json::Value;
use tracing::info;

use crate::cdc::websocket::events::post_event as post_event_websocket;

/// Best-effort event publisher: currently logs the event payload.
pub async fn post_event(company_id: String, event: Value) {
    #[cfg(feature = "cdc")]
    {
        // When the CDC websocket server is running, also emit into its broadcast pipeline.
        post_event_websocket(company_id.clone(), event.clone()).await;
    }
    info!(%company_id, event = %event, "Event published");
}
