//! Queuerious SDK adapter for lapin (RabbitMQ).
//!
//! Wraps `lapin::Consumer` to automatically report job lifecycle events
//! (started, completed, failed, retrying) to the Queuerious platform.
//!
//! # Quick Start
//!
//! ```no_run
//! use queuerious::QueuriousClient;
//! use queuerious_lapin::TrackedConsumer;
//! use std::sync::Arc;
//!
//! # async fn example(channel: &lapin::Channel) -> Result<(), Box<dyn std::error::Error>> {
//! let client = Arc::new(
//!     QueuriousClient::builder()
//!         .api_key("qk_your_key")
//!         .build()?
//! );
//!
//! let consumer = channel.basic_consume(
//!     "my-queue", "my-consumer",
//!     lapin::options::BasicConsumeOptions::default(),
//!     lapin::types::FieldTable::default(),
//! ).await?;
//!
//! let mut tracked = TrackedConsumer::new(consumer, "my-queue", client);
//!
//! // Use next_tracked() for full lifecycle tracking.
//! while let Some(delivery) = tracked.next_tracked().await {
//!     let delivery = delivery?;
//!     // Process message...
//!     delivery.ack(lapin::options::BasicAckOptions::default()).await?;
//! }
//! # Ok(())
//! # }
//! ```

mod config;
mod consumer;
mod delivery;

pub mod channel_factory;

#[cfg(feature = "metrics")]
pub mod metrics;

#[cfg(feature = "commands")]
pub mod commands;

pub use channel_factory::{ChannelFactory, StaticConnectionFactory};
pub use config::{extract_default_metadata, LapinAdapterConfig};
pub use consumer::{TrackedConsumer, TrackedConsumerError};
pub use delivery::TrackedDelivery;

#[cfg(any(feature = "metrics", feature = "commands"))]
mod runtime;

#[cfg(feature = "commands")]
pub use commands::RabbitMqCommandExecutor;

#[cfg(any(feature = "metrics", feature = "commands"))]
pub use runtime::{ObservabilityRuntime, RuntimeBuilder};
