mod container;
mod inject;
mod resolver;

pub use crate::arc_dyn;
pub use crate::shared_dyn;
pub use container::Container;
pub use inject::Injectable;
pub use noema_macros::Injectable;
pub use resolver::Resolver;
pub use std::sync::Arc;

/// A type alias for a boxed dynamic error that is Send and Sync, suitable for use in async contexts and across threads.
pub type BoxDynError = Box<dyn std::error::Error + Send + Sync>;

pub type NoemaResult<T> = Result<T, BoxDynError>;

/// A helper macro to create a type alias for a dynamic trait object wrapped in an Arc.
/// Arc<dyn Trait + Send + Sync>
#[macro_export]
macro_rules! arc_dyn {
    ($trait:path) => {
        Arc<dyn $trait + Send + Sync>
    };
}

/// A helper macro to create a type alias for a dynamic trait object that is Send and Sync.
/// dyn Trait + Send + Sync
#[macro_export]
macro_rules! shared_dyn {
    ($trait:path) => {
        dyn $trait + Send + Sync
    };
}
