//! Message Queue Consumer Library
//!
//! This library provides a Rust client for consuming messages from AMQP-based
//! message queues (e.g., RabbitMQ).
//!
//! # Intentional Violations (Aphoria Dogfood)
//!
//! This library contains **8 intentional violations** for testing Aphoria's
//! scanning and detection capabilities:
//!
//! 1. **Zero Timeout** (`config.rs:20`) - Consumer timeout set to 0
//! 2. **Missing Backpressure** (`config.rs:26`) - Unbounded in-memory queue
//! 3. **Unbounded Prefetch** (`config.rs:33`) - QoS prefetch set to u16::MAX
//! 4. **Auto-Ack Without Processing** (`consumer.rs:35`) - Messages acked before processing
//! 5. **No Requeue Limit** (`consumer.rs:42`) - Infinite requeue attempts
//! 6. **Missing TLS Validation** (`config.rs:68`) - Certificate verification disabled
//! 7. **No Connection Pooling** (`config.rs:79`) - Unbounded connections
//! 8. **Synchronous Processing** (`processor.rs:38`) - Blocking in async context
//!
//! # Examples
//!
//! ```no_run
//! use msgqueue_consumer::{Consumer, ConsumerConfig, MessageProcessor, ProcessingMode};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//!     let config = ConsumerConfig::default();
//!     let mut consumer = Consumer::new(config);
//!
//!     consumer.connect().await?;
//!     consumer.start_consuming().await?;
//!
//!     let processor = MessageProcessor::new(ProcessingMode::Async);
//!     consumer.process_messages(|data| {
//!         // Process message data
//!         Ok(())
//!     }).await?;
//!
//!     consumer.disconnect().await?;
//!     Ok(())
//! }
//! ```

pub mod config;
pub mod connection;
pub mod consumer;
pub mod error;
pub mod processor;

// Re-export main types
pub use config::{ConsumerConfig, TlsConfig, ConnectionPoolConfig};
pub use connection::{ConnectionPool, PooledConnection, PoolStats};
pub use consumer::{Consumer, AckMode};
pub use error::ConsumerError;
pub use processor::{MessageProcessor, ProcessingMode};

/// Library version
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

/// Get a summary of all violations in this library
pub fn list_violations() -> Vec<&'static str> {
    vec![
        "VIOLATION 1: Consumer timeout set to zero (indefinite blocking)",
        "VIOLATION 2: Unbounded in-memory queue (OOM under load)",
        "VIOLATION 3: Prefetch count set to u16::MAX (resource exhaustion)",
        "VIOLATION 4: Auto-ack without processing guarantee (data loss)",
        "VIOLATION 5: No requeue limit (infinite retry loops)",
        "VIOLATION 6: TLS certificate verification disabled (MITM attacks)",
        "VIOLATION 7: Unbounded connection pool (file descriptor exhaustion)",
        "VIOLATION 8: Blocking operations in async context (throughput collapse)",
    ]
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_version() {
        assert!(!VERSION.is_empty());
    }

    #[test]
    fn test_violations_list() {
        let violations = list_violations();
        assert_eq!(violations.len(), 8);
    }
}
