//! Curated composite, context intelligence, telemetry, and dry-run tool entries.

use crate::contract::error_code::ErrorCode;

use super::builders::{tool, DB_ERR, WRITE_UP};
use super::types::{Lane, ToolCategory, ToolEntry};

/// Dry-run, context intelligence, telemetry, and composite tools.
pub(super) fn composite_tools() -> Vec<ToolEntry> {
    vec![
        // ── Dry-run validation tools ──────────────────────────────────
        tool(
            "x_post_tweet_dry_run",
            ToolCategory::Write,
            Lane::Workflow,
            false, // dry-run is not a mutation
            false,
            false,
            true,
            WRITE_UP,
            &[
                ErrorCode::TweetTooLong,
                ErrorCode::InvalidInput,
                ErrorCode::PolicyError,
            ],
        ),
        tool(
            "x_post_thread_dry_run",
            ToolCategory::Write,
            Lane::Workflow,
            false,
            false,
            false,
            true,
            WRITE_UP,
            &[
                ErrorCode::TweetTooLong,
                ErrorCode::InvalidInput,
                ErrorCode::PolicyError,
            ],
        ),
        // ── Context Intelligence ─────────────────────────────────────
        tool(
            "get_author_context",
            ToolCategory::Context,
            Lane::Workflow,
            false,
            true,
            false,
            true,
            WRITE_UP,
            &[
                ErrorCode::XNotConfigured,
                ErrorCode::ContextError,
                ErrorCode::DbError,
            ],
        ),
        tool(
            "recommend_engagement_action",
            ToolCategory::Context,
            Lane::Workflow,
            false,
            true,
            false,
            true,
            WRITE_UP,
            &[
                ErrorCode::XNotConfigured,
                ErrorCode::RecommendationError,
                ErrorCode::DbError,
            ],
        ),
        tool(
            "topic_performance_snapshot",
            ToolCategory::Context,
            Lane::Workflow,
            false,
            false,
            false,
            true,
            WRITE_UP,
            &[ErrorCode::TopicError, ErrorCode::DbError],
        ),
        // ── Telemetry ────────────────────────────────────────────────
        tool(
            "get_mcp_tool_metrics",
            ToolCategory::Telemetry,
            Lane::Workflow,
            false,
            false,
            false,
            true,
            WRITE_UP,
            DB_ERR,
        ),
        tool(
            "get_mcp_error_breakdown",
            ToolCategory::Telemetry,
            Lane::Workflow,
            false,
            false,
            false,
            true,
            WRITE_UP,
            DB_ERR,
        ),
        // ── Composite ────────────────────────────────────────────────
        tool(
            "find_reply_opportunities",
            ToolCategory::Composite,
            Lane::Workflow,
            false,
            true,
            false,
            true,
            WRITE_UP,
            &[
                ErrorCode::XNotConfigured,
                ErrorCode::InvalidInput,
                ErrorCode::XApiError,
                ErrorCode::DbError,
            ],
        ),
        tool(
            "draft_replies_for_candidates",
            ToolCategory::Composite,
            Lane::Workflow,
            false,
            false,
            true,
            true,
            WRITE_UP,
            &[
                ErrorCode::InvalidInput,
                ErrorCode::LlmNotConfigured,
                ErrorCode::LlmError,
                ErrorCode::DbError,
            ],
        ),
        tool(
            "propose_and_queue_replies",
            ToolCategory::Composite,
            Lane::Workflow,
            true,
            true,
            false,
            true,
            WRITE_UP,
            &[
                ErrorCode::InvalidInput,
                ErrorCode::XNotConfigured,
                ErrorCode::XApiError,
                ErrorCode::DbError,
                ErrorCode::PolicyDeniedBlocked,
                ErrorCode::PolicyDeniedRateLimited,
                ErrorCode::PolicyDeniedHardRule,
                ErrorCode::PolicyDeniedUserRule,
                ErrorCode::PolicyError,
            ],
        ),
        tool(
            "generate_thread_plan",
            ToolCategory::Composite,
            Lane::Workflow,
            false,
            false,
            true,
            false,
            WRITE_UP,
            &[
                ErrorCode::LlmNotConfigured,
                ErrorCode::LlmError,
                ErrorCode::InvalidInput,
            ],
        ),
    ]
}
