//! mcp-host: Production-grade MCP server implementation
//!
//! This crate provides a comprehensive Model Context Protocol (MCP) server
//! implementation with sophisticated features like circuit breakers, visibility
//! predicates, session customization, and more.
//!
//! ## Features
//!
//! - `stdio` - STDIO transport (default)
//! - `http` - HTTP transport via rama
//! - `macros` - Procedural macros (#[mcp_tool], #[mcp_prompt], #[mcp_resource], etc.)
//! - `full` - All features
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use mcp_host::prelude::*;
//! use mcp_host::macros::text;
//! use schemars::JsonSchema;
//! use serde::Deserialize;
//!
//! #[derive(Deserialize, JsonSchema)]
//! struct GreetParams {
//!     name: String,
//! }
//!
//! struct MyServer;
//!
//! #[mcp_tool_router]
//! impl MyServer {
//!     #[mcp_tool(name = "greet")]
//!     async fn greet(&self, _ctx: Ctx<'_>, params: Parameters<GreetParams>) -> ToolResult {
//!         Ok(vec![text(&format!("Hello, {}!", params.0.name))])
//!     }
//! }
//!
//! #[tokio::main]
//! async fn main() {
//!     let server = mcp_host::server::builder::server("my-server", "1.0.0")
//!         .with_tools(true)
//!         .build();
//!
//!     let my_server = std::sync::Arc::new(MyServer);
//!     MyServer::tool_router().register_all(server.tool_registry(), my_server);
//!
//!     server.run(StdioTransport::new()).await.unwrap();
//! }
//! ```
//!
//! Enable macros with: `mcp-host = { version = "0.1", features = ["macros"] }`

pub mod content;
pub mod logging;
#[cfg(feature = "macros")]
pub mod macros;
pub mod managers;
pub mod protocol;
pub mod registry;
pub mod server;
pub mod transport;
pub mod utils;

// Re-export commonly used types
pub mod prelude {
    // Protocol types
    pub use crate::protocol::capabilities::{ClientCapabilities, ServerCapabilities};
    pub use crate::protocol::types::{
        JsonRpcError, JsonRpcRequest, JsonRpcResponse, ToolAnnotations,
    };

    // Content types and builders
    pub use crate::content::annotations::Annotations;
    pub use crate::content::builder::{audio, image, resource, text};
    pub use crate::content::resource::ResourceContent;
    pub use crate::content::types::{
        AudioContent, Content, ImageContent, ResourceLink, TextContent,
    };

    // Server types
    pub use crate::server::builder::{server, ServerBuilder};
    pub use crate::server::core::Server;
    pub use crate::server::multiplexer::{
        ClientRequester, CreateMessageParams, CreateMessageResult, JsonRpcClientRequest,
        ListRootsResult, ModelHint, ModelPreferences, MultiplexerError, RequestMultiplexer, Root,
        SamplingContent, SamplingMessage,
    };
    pub use crate::server::profile::SessionProfile;
    pub use crate::server::session::Session;
    pub use crate::server::visibility::{
        Environment, ExecutionContext, SimpleEnvironment, VisibilityContext,
    };

    // Prompt message types
    pub use crate::content::prompt::{PromptContent, PromptMessage, PromptRole};

    // Completion types
    pub use crate::protocol::types::{
        CompleteRequest, CompleteResult, CompletionArgument, CompletionInfo, CompletionRef,
        CompletionValue,
    };

    // Utility functions
    pub use crate::utils::{
        base64_decode, base64_encode, byte_to_line_col, collect_files, decode_cursor,
        encode_cursor, is_safe_path, paginate, PaginatedResult, DEFAULT_PAGE_SIZE,
    };

    // Transport traits
    pub use crate::transport::traits::{
        IncomingMessage, JsonRpcNotification, Transport, TransportError,
    };

    // Registry types
    pub use crate::registry::prompts::{
        GetPromptResult, Prompt, PromptArgument, PromptError, PromptInfo, PromptManager,
    };
    pub use crate::registry::resources::{
        Resource, ResourceError, ResourceInfo, ResourceManager, ResourceRetryConfig,
        ResourceTemplate, ResourceTemplateInfo,
    };
    pub use crate::registry::tools::{
        Tool, ToolBreakerConfig, ToolError, ToolHelpers, ToolInfo, ToolLifecycleState,
        ToolOutput, ToolPolicy, ToolRegistry,
    };

    // Middleware
    pub use crate::server::middleware::{RateLimiter, RateLimiterConfig};

    // Logging
    pub use crate::logging::{send_log_notification, LogLevel, LoggerConfig, McpLogger};

    // Managers
    pub use crate::managers::cancellation::{CancellationManager, CancellationToken};
    pub use crate::managers::completion::{CompletionError, CompletionManager, CompletionProvider};
    pub use crate::managers::progress::{ProgressToken, ProgressTracker};
    pub use crate::managers::subscription::SubscriptionManager;
    pub use crate::managers::task::{TaskError, TaskStore};

    // === Feature-gated exports ===

    // STDIO transport
    #[cfg(feature = "stdio")]
    pub use crate::transport::stdio::StdioTransport;

    // HTTP transport
    #[cfg(feature = "http")]
    pub use crate::transport::http::{HttpTransport, HttpTransportConfig, HttpTransportError};

    // Routers and helpers (requires macros feature)
    #[cfg(feature = "macros")]
    pub use crate::registry::router::{
        prompt_info, prompt_info_with_args, tool_info, tool_info_with_output, McpPromptRouter,
        McpResourceRouter, McpResourceTemplateRouter, McpRouter, McpToolRouter,
    };

    // Macro support types (requires macros feature)
    #[cfg(feature = "macros")]
    pub use crate::macros::{
        assistant_image_message, assistant_message, blob_resource, prompt_messages,
        prompt_with_description, schema_for, structured, text_resource, text_resource_with_mime,
        user_image_message, user_message, Ctx, FromExecutionContext, IntoToolResult, Parameters,
        PromptResult, ResourceResult, ToolResult,
    };

    // Procedural macros (requires macros feature)
    #[cfg(feature = "macros")]
    pub use mcp_host_macros::{
        mcp_prompt, mcp_resource, mcp_resource_template, mcp_router, mcp_tool,
    };
}
