//! Chat Server pour Veza
//!
//! Serveur de chat temps réel avec WebSocket

pub mod config;
pub mod database;
pub mod delivered_status;
pub mod env;
pub mod error;
pub mod event_bus;
pub mod jwt_manager;
pub mod middleware;
pub mod models;
pub mod monitoring;
pub mod permissions;
pub mod read_receipts;
pub mod repository;
pub mod security;
pub mod services;
pub mod simple_message_store;
pub mod typing_indicator;
pub mod websocket; // ORIGIN Architecture: Event-driven via RabbitMQ // Metrics and monitoring

// Ré-exporter types principaux
pub use error::{ChatError, Result};
pub use repository::{MessageRepository, Room, RoomMember, RoomRepository};
pub use services::RoomService;
pub use simple_message_store::SimpleMessageStore;
pub use websocket::{IncomingMessage, OutgoingMessage, WebSocketManager};

#[cfg(test)]
mod tests {
    use super::*;
    use error::ChatError;
    use simple_message_store::SimpleMessage;

    #[tokio::test]
    async fn test_simple_message_store() {
        let store = SimpleMessageStore::new();

        let msg_id = store
            .send_simple_message("Test message", "test_user", None, false)
            .await
            .unwrap();

        assert!(msg_id > 0);
    }
}
