#![warn(missing_docs)]
#![allow(refining_impl_trait_internal, refining_impl_trait_reachable)]
#![doc = include_str!("../README.md")]

pub mod config;
pub mod error;
#[cfg(feature = "axum")]
pub mod health;
#[cfg(feature = "metrics")]
pub mod metrics;
pub mod middleware;
pub mod prelude;
pub mod router;
pub mod service;
#[cfg(feature = "axum")]
pub mod testing;

#[cfg(feature = "axum")]
pub use health::HealthRouter;

pub mod client;
#[cfg(feature = "sqlx-postgres")]
pub mod db;
#[cfg(feature = "election")]
pub mod election;
#[cfg(feature = "nats")]
pub mod mq;
pub mod server;

// Re-export connectrpc essentials for convenience
pub use connectrpc::{
    ConnectError, ConnectRpcBody, ConnectRpcService, ErrorCode, Protocol, RequestContext, Router,
    Server,
};

// Re-export buffa essentials
pub use buffa::view::{MessageView, OwnedView};

/// Boxed error type for middleware
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;

/// Boxed future type
pub type BoxFuture<T> = std::pin::Pin<Box<dyn std::future::Future<Output = T> + Send>>;

/// Result type using BoxError
pub type BoxResult<T> = Result<T, BoxError>;

#[cfg(test)]
mod tests {
    #[test]
    fn test_lib_compiles() {
        // This test just verifies the library compiles
        // Real tests are in the tests/ directory
    }
}
