#![warn(missing_docs)]
#![doc = include_str!("../README.md")]
//! - **Leader Election**: Vault/OpenBAO and NATS-based leader election
//! - **Client Utilities**: Factory, retry, circuit breaker patterns
//! - **Testing**: Test harness, mocks, fixtures, testcontainers integration
//! - **Automatic Instrumentation**: Proc-macro derive for metrics and tracing
//!
//! ## Quick Start
//!
//! See the `examples/` directory for complete working examples.
//!
//! ```rust,ignore
//! // Example usage (conceptual - see examples for real code)
//! use sunbeam_g2v::prelude::*;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//!     let config = ServiceConfig::load()?;
//!
//!     let router = ServiceRouter::new();
//!
//!     ServerBuilder::new()
//!         .with_router(router)
//!         .with_metrics()
//!         .with_tracing()
//!         .with_health_check("/health")
//!         .serve()
//!         .await
//! }
//! ```

#![allow(refining_impl_trait_internal, refining_impl_trait_reachable)]

pub mod config;
pub mod error;
pub mod health;
pub mod metrics;
pub mod middleware;
pub mod prelude;
pub mod router;
pub mod service;
pub mod testing;

pub use health::HealthRouter;

pub mod client;
pub mod db;
pub mod election;
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
    }
}
