#![allow(
    dead_code,
    unused_imports,
    unused_variables,
    unused_assignments,
    unused
)]

//! Provisioning RAG System
//!
//! This module provides retrieval-augmented generation (RAG) capabilities
//! for the provisioning platform using Rig framework and SurrealDB.
//!
//! # Features
//!
//! - Semantic document search across markdown, KCL, and Nushell code
//! - RAG agent with context-aware responses using Claude LLM
//! - Workspace-aware context extraction and enrichment
//! - Deployment event tracking and analytics
//! - Configuration pattern discovery from KCL schemas
//! - AI-powered workspace generation from natural language
//!
//! # Architecture
//!
//! The RAG system is built on three main components:
//!
//! 1. **Embeddings**: Document chunking and embedding generation using OpenAI
//! 2. **Vector Store**: SurrealDB with HNSW indexing for semantic search
//! 3. **RAG Agent**: Rig framework agent for context-aware generation

pub mod agent;
pub mod agent_tools;
pub mod api;
pub mod batch_processing;
pub mod caching;
pub mod chunking;
pub mod config;
pub mod context;
pub mod conversations;
pub mod db;
pub mod embeddings;
pub mod error;
pub mod hybrid_search;
pub mod ingestion;
pub mod llm;
pub mod monitoring;
pub mod orchestrator;
pub mod query_optimization;
pub mod retrieval;
pub mod streaming;
pub mod tools;

// Re-export main types
pub use agent::{AgentResponse, RagAgent};
pub use agent_tools::{AgentResponseWithTools, ToolCall, ToolEnabledRagAgent};
pub use api::{
    create_router, ApiState, BatchQueryRequest, BatchResponse, BatchStats, CacheStatsResponse,
    ComponentHealth, ConversationRequest, ConversationResponse, ErrorResponse, HealthResponse,
    QueryRequest, QueryResponse,
};
pub use batch_processing::{BatchAgent, BatchJob, BatchProgress, BatchQuery, BatchResult};
pub use caching::{CacheStats, CachedResponse, ResponseCache};
pub use config::RagConfig;
pub use context::WorkspaceContext;
pub use conversations::{
    ConversationAgent, ConversationContext, ConversationTurn, FollowupDetector,
};
pub use db::DbConnection;
pub use embeddings::EmbeddingEngine;
pub use error::{RagError, Result};
pub use hybrid_search::{BM25Parameters, HybridSearchEngine, HybridSearchResult, KeywordIndex};
pub use llm::LlmClient;
pub use monitoring::{ConfidenceDistribution, ErrorType, LatencyHistogram, RagMetrics};
pub use orchestrator::{
    BatchQueryTask, ConversationTask, OrchestratorHealth, OrchestratorManager, OrchestratorStats,
    OrchestratorTask, OrchestratorTaskType, TaskStatus, ToolExecutionTask,
};
pub use query_optimization::{
    IntentDetector, OptimizedQuery, QueryIntent, QueryOptimizer, SynonymProvider,
};
pub use retrieval::{RetrieverEngine, SearchResult};
pub use streaming::{SseParser, StreamToken, StreamingAgent};
pub use tools::{
    CreateServerTool, RagTool, TaskservManagementTool, ToolCallStats, ToolDefinition, ToolInput,
    ToolOutput, ToolRegistry, WorkspaceStatusTool,
};

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

    #[test]
    fn test_module_loads() {
        // Basic smoke test to ensure all modules compile
        let _config = RagConfig::default();
    }
}
