//! Events service — public API for the events domain.
//!
//! Re-exports [`StoredEvent`], the wire format shared by the gateway's
//! WS-based event-push relay (`gateway_relay.rs` on the project side,
//! `http/gateway/websocket.rs`'s event-push handler on the gateway side).
//!
//! Conventions: `docs/architecture/service-modules.md`

/// Pure event types — no side effects.
pub mod buffer;

pub use buffer::StoredEvent;

// ── Error type ────────────────────────────────────────────────────────────────

/// Typed errors returned by `service::events` functions.
///
/// Events operations are currently infallible; this enum exists to satisfy
/// the module convention and to accommodate future error cases (e.g.
/// persistence).
#[allow(dead_code)]
#[derive(Debug)]
pub enum Error {
    /// A serialisation or internal error occurred.
    Internal(String),
}

impl std::fmt::Display for Error {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Internal(msg) => write!(f, "Events error: {msg}"),
        }
    }
}
