from typing import Any

# ==============================================================================
# READY-MADE BOT MANIFEST CATALOG (25 PRODUCTION BLUEPRINTS)
# ==============================================================================

BOT_MANIFESTS: list[dict[str, Any]] = [
    # --------------------------------------------------------------------------
    # 1. BUSINESS BOTS (6 BOTS)
    # --------------------------------------------------------------------------
    {
        "id": "bot_ecommerce_concierge",
        "name": "E-Commerce & Digital Store Concierge",
        "headline": "Interactive shopping catalog, cart management & instant Telegram checkout.",
        "description": "Transforms your Telegram bot into an automated 24/7 digital storefront. Customers can browse categorized products with images, add items to cart, select delivery address, and pay via integrated Razorpay/Stripe checkout without leaving Telegram.",
        "category": "business",
        "icon": "shopping-bag",
        "version": "1.2.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": True,
        "rating": 4.95,
        "install_count": 1420,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "payments.create", "database.read_write"],
        "config_schema": {
            "store_name": {"type": "string", "title": "Store Name", "default": "Digital Store"},
            "currency": {"type": "string", "title": "Store Currency", "enum": ["INR", "USD", "EUR"], "default": "INR"},
            "shipping_fee": {"type": "number", "title": "Flat Shipping Fee", "default": 0},
            "support_email": {"type": "string", "title": "Support Contact Email", "default": "support@store.com"},
            "auto_receipt": {"type": "boolean", "title": "Auto-send PDF invoice", "default": True},
        },
        "default_config": {
            "store_name": "Premium Boutique",
            "currency": "INR",
            "shipping_fee": 0,
            "support_email": "concierge@boutique.com",
            "auto_receipt": True,
        },
        "system_templates": ["welcome", "catalog", "cart_view", "invoice", "order_status"],
        "mcp_tools": ["shopify.products.search", "payments.order.verify", "shipping.status.get"],
        "modules": [
            {"id": "module_cart_manager", "version": "1.0.0"},
            {"id": "module_payment_checkout", "version": "1.0.0"},
        ],
        "tags": ["ecommerce", "store", "payments", "shopping", "cart"],
    },
    {
        "id": "bot_customer_support",
        "name": "AI Customer Support Desk",
        "headline": "Tier-1 AI resolution with seamless human agent ticket escalation.",
        "description": "Automate 80% of customer inquiries with smart contextual AI answers. Detects frustrated users and automatically opens priority tickets with notification alerts to your human support team.",
        "category": "business",
        "icon": "headphones",
        "version": "1.1.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": True,
        "rating": 4.92,
        "install_count": 980,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "notifications.dispatch", "ai.completion"],
        "config_schema": {
            "company_name": {"type": "string", "title": "Company Name", "default": "Acme Corp"},
            "escalation_threshold": {"type": "number", "title": "Sentiment Escalation Threshold (0-1)", "default": 0.3},
            "support_hours": {"type": "string", "title": "Human Support Hours", "default": "09:00 - 18:00 IST"},
            "enable_ai_answers": {"type": "boolean", "title": "AI Instant Answer", "default": True},
        },
        "default_config": {
            "company_name": "Acme Cloud",
            "escalation_threshold": 0.35,
            "support_hours": "24/7 Virtual Support",
            "enable_ai_answers": True,
        },
        "system_templates": ["welcome", "ticket_created", "ticket_resolved", "agent_connected"],
        "mcp_tools": ["zendesk.ticket.create", "crm.contact.lookup"],
        "modules": [
            {"id": "module_anti_spam_shield", "version": "1.0.0"},
        ],
        "tags": ["support", "tickets", "helpdesk", "ai", "crm"],
    },
    {
        "id": "bot_lead_crm",
        "name": "Lead Qualifier & CRM Sync",
        "headline": "Capture, score, and push high-intent leads into your CRM in real time.",
        "description": "Engage prospective customers through interactive conversational qualification funnels. Scores leads based on budget and urgency, then syncs details into your CRM with instant alerts to sales reps.",
        "category": "business",
        "icon": "user-check",
        "version": "1.0.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.88,
        "install_count": 650,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "database.read_write"],
        "config_schema": {
            "lead_notification_channel_id": {"type": "string", "title": "Sales Alert Channel/Group ID"},
            "min_budget_threshold": {"type": "number", "title": "High Priority Budget Threshold", "default": 1000},
            "collect_phone": {"type": "boolean", "title": "Ask for Phone Number Contact Share", "default": True},
        },
        "default_config": {
            "lead_notification_channel_id": "",
            "min_budget_threshold": 1000,
            "collect_phone": True,
        },
        "system_templates": ["welcome", "qualification_step", "lead_confirmed"],
        "mcp_tools": ["hubspot.lead.create", "google_sheets.row.append"],
        "modules": [],
        "tags": ["leads", "sales", "crm", "funnel", "b2b"],
    },
    {
        "id": "bot_appointment_booking",
        "name": "Calendar & Appointment Scheduler",
        "headline": "Interactive calendar slot picker with automated reminders and confirmations.",
        "description": "Let clients book consultations, salon slots, doctor appointments, or coaching calls directly inside Telegram. Syncs with Google Calendar, sends automated 24h & 1h reminders, and handles cancellations.",
        "category": "business",
        "icon": "calendar",
        "version": "1.0.5",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.85,
        "install_count": 510,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "scheduler.create_job"],
        "config_schema": {
            "slot_duration_minutes": {"type": "integer", "title": "Slot Duration (Minutes)", "default": 30},
            "working_hours_start": {"type": "string", "title": "Start Time (HH:MM)", "default": "10:00"},
            "working_hours_end": {"type": "string", "title": "End Time (HH:MM)", "default": "18:00"},
            "advance_days_allowed": {"type": "integer", "title": "Max Booking Window (Days)", "default": 14},
        },
        "default_config": {
            "slot_duration_minutes": 30,
            "working_hours_start": "10:00",
            "working_hours_end": "18:00",
            "advance_days_allowed": 14,
        },
        "system_templates": ["welcome", "slot_selector", "booking_confirmation", "reminder_alert"],
        "mcp_tools": ["google_calendar.events.insert", "google_calendar.events.check_free"],
        "modules": [],
        "tags": ["booking", "calendar", "appointment", "schedule", "reminders"],
    },
    {
        "id": "bot_invoice_billing",
        "name": "Invoice & Instant Pay Generator",
        "headline": "Generate tax-compliant invoices, checkout payment links, and receipts.",
        "description": "Quickly create itemized invoices with GST/VAT calculations on the fly. Generates secure Razorpay/Stripe checkout buttons, verifies transactions server-side, and generates downloadable receipts.",
        "category": "business",
        "icon": "receipt",
        "version": "1.1.2",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.90,
        "install_count": 780,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "payments.create"],
        "config_schema": {
            "business_legal_name": {"type": "string", "title": "Business Legal Name", "default": "Cloud Global Inc"},
            "tax_rate_percent": {"type": "number", "title": "Default Tax / GST (%)", "default": 18.0},
            "currency": {"type": "string", "title": "Default Currency", "default": "INR"},
        },
        "default_config": {
            "business_legal_name": "Enterprise Billing Ltd",
            "tax_rate_percent": 18.0,
            "currency": "INR",
        },
        "system_templates": ["welcome", "invoice", "receipt_paid", "payment_failed"],
        "mcp_tools": ["payments.invoice.create", "accounting.ledger.record"],
        "modules": [
            {"id": "module_payment_checkout", "version": "1.0.0"},
        ],
        "tags": ["billing", "invoice", "receipts", "gst", "payments"],
    },
    {
        "id": "bot_subscription_vip",
        "name": "VIP Subscription & Paid Channel Gatekeeper",
        "headline": "Monetize private Telegram channels with recurring auto-kick subscriptions.",
        "description": "Full monetization solution for private channels, trading groups, and VIP communities. Handles subscription renewals, sends expiry alerts, issues temporary invite links, and auto-removes expired members.",
        "category": "business",
        "icon": "crown",
        "version": "1.3.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": True,
        "rating": 4.97,
        "install_count": 1890,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "chat.manage_members", "payments.create"],
        "config_schema": {
            "vip_channel_id": {"type": "string", "title": "Target VIP Channel/Group ID"},
            "monthly_price": {"type": "number", "title": "Monthly Subscription Price", "default": 499},
            "annual_price": {"type": "number", "title": "Annual Subscription Price", "default": 4999},
            "grace_period_days": {"type": "integer", "title": "Grace Period Days Before Kick", "default": 2},
        },
        "default_config": {
            "vip_channel_id": "",
            "monthly_price": 499,
            "annual_price": 4999,
            "grace_period_days": 2,
        },
        "system_templates": ["welcome", "plan_picker", "invoice", "channel_invite", "expiry_warning"],
        "mcp_tools": ["telegram.chat.create_invite_link", "telegram.chat.ban_member"],
        "modules": [
            {"id": "module_payment_checkout", "version": "1.0.0"},
            {"id": "module_referral_tracker", "version": "1.0.0"},
        ],
        "tags": ["subscriptions", "vip", "paywall", "channel", "recurring"],
    },

    # --------------------------------------------------------------------------
    # 2. COMMUNITY BOTS (6 BOTS)
    # --------------------------------------------------------------------------
    {
        "id": "bot_group_admin_pro",
        "name": "Group Admin Pro & Moderation Guard",
        "headline": "Complete community governance: anti-flood, word filters, warnings & auto-kick.",
        "description": "Protect your community from raids, repetitive flooding, unauthorized forward links, and toxic language. Features strikes/warning management, temporary mutes, and detailed moderator audit logs.",
        "category": "community",
        "icon": "shield-alert",
        "version": "2.0.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": True,
        "rating": 4.94,
        "install_count": 2300,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.delete", "chat.restrict_members", "chat.manage_members"],
        "config_schema": {
            "max_warnings": {"type": "integer", "title": "Max Warnings Before Ban", "default": 3},
            "anti_flood_messages": {"type": "integer", "title": "Flood Limit (messages per 5s)", "default": 5},
            "delete_link_forwards": {"type": "boolean", "title": "Delete Forwards with Links", "default": True},
        },
        "default_config": {
            "max_warnings": 3,
            "anti_flood_messages": 5,
            "delete_link_forwards": True,
        },
        "system_templates": ["user_warned", "user_muted", "user_banned", "rules_screen"],
        "mcp_tools": ["telegram.chat.restrict_member", "telegram.messages.delete"],
        "modules": [
            {"id": "module_anti_spam_shield", "version": "1.0.0"},
        ],
        "tags": ["moderation", "admin", "groups", "anti-flood", "safety"],
    },
    {
        "id": "bot_anti_spam_guard",
        "name": "AI Anti-Spam & Phishing Shield",
        "headline": "Real-time AI heuristic analysis to detect spam bots, crypto scams & phishing URLs.",
        "description": "Instantly deletes malicious crypto impersonation scams, phishing domains, user bot attacks, and stealth advertisements. Protects group reputation with zero false positives.",
        "category": "community",
        "icon": "shield-check",
        "version": "1.4.1",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.91,
        "install_count": 1650,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.delete", "chat.restrict_members"],
        "config_schema": {
            "ai_strictness_level": {"type": "string", "enum": ["low", "medium", "aggressive"], "default": "medium"},
            "ban_on_phishing": {"type": "boolean", "title": "Instant Ban on Confirmed Phishing", "default": True},
        },
        "default_config": {
            "ai_strictness_level": "medium",
            "ban_on_phishing": True,
        },
        "system_templates": ["spam_blocked", "quarantine_notice"],
        "mcp_tools": ["url_scanner.reputation.check", "ai.spam_classifier"],
        "modules": [
            {"id": "module_anti_spam_shield", "version": "1.0.0"},
        ],
        "tags": ["antispam", "security", "phishing", "crypto", "moderation"],
    },
    {
        "id": "bot_welcome_verification",
        "name": "Interactive Welcome & Captcha Gate",
        "headline": "Prevent raid bots with math and button verification before granting chat access.",
        "description": "New joiners are muted until they complete an interactive math or emoji captcha puzzle within 60 seconds. Displays customizable decorative welcome rules once verified.",
        "category": "community",
        "icon": "key-round",
        "version": "1.2.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.89,
        "install_count": 1120,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "chat.restrict_members"],
        "config_schema": {
            "captcha_type": {"type": "string", "enum": ["button_click", "math_puzzle", "emoji_match"], "default": "button_click"},
            "timeout_seconds": {"type": "integer", "title": "Verification Timeout (Seconds)", "default": 60},
            "welcome_message": {"type": "string", "title": "Welcome Text", "default": "Welcome {first_name}! Please solve the puzzle below:"},
        },
        "default_config": {
            "captcha_type": "button_click",
            "timeout_seconds": 60,
            "welcome_message": "Welcome {first_name}! Please verify you are human below:",
        },
        "system_templates": ["captcha_prompt", "verified_success", "timeout_kick"],
        "mcp_tools": [],
        "modules": [
            {"id": "module_captcha_gate", "version": "1.0.0"},
        ],
        "tags": ["welcome", "captcha", "verification", "anti-raid", "community"],
    },
    {
        "id": "bot_quiz_trivia",
        "name": "Community Quiz & Trivia Arena",
        "headline": "Boost engagement with timed quiz competitions, leaderboards, and prizes.",
        "description": "Host scheduled or on-demand trivia tournaments in your Telegram group. Tracks participant response time, generates live leaderboard rankings, and awards digital badges or token points.",
        "category": "community",
        "icon": "trophy",
        "version": "1.0.2",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.82,
        "install_count": 430,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "database.read_write"],
        "config_schema": {
            "question_time_limit_sec": {"type": "integer", "title": "Seconds per Question", "default": 20},
            "questions_per_round": {"type": "integer", "title": "Questions per Round", "default": 10},
            "category": {"type": "string", "title": "Default Trivia Category", "default": "General Knowledge"},
        },
        "default_config": {
            "question_time_limit_sec": 20,
            "questions_per_round": 10,
            "category": "General Knowledge",
        },
        "system_templates": ["quiz_start", "question_card", "round_summary", "leaderboard"],
        "mcp_tools": [],
        "modules": [],
        "tags": ["quiz", "trivia", "engagement", "gamification", "leaderboard"],
    },
    {
        "id": "bot_content_moderation",
        "name": "Media Filter & Content Censure",
        "headline": "Inspect uploaded images, stickers, and documents for sensitive or prohibited media.",
        "description": "Automatically inspects images and stickers using AI computer vision to prevent NSFW media, graphic violence, and unapproved external promotional flyers from infiltrating your chats.",
        "category": "community",
        "icon": "eye-off",
        "version": "1.1.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.86,
        "install_count": 690,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.delete", "chat.restrict_members"],
        "config_schema": {
            "filter_nsfw_images": {"type": "boolean", "title": "Filter NSFW & Adult Content", "default": True},
            "delete_unregistered_stickers": {"type": "boolean", "title": "Delete Sticker Pack Spam", "default": False},
        },
        "default_config": {
            "filter_nsfw_images": True,
            "delete_unregistered_stickers": False,
        },
        "system_templates": ["media_deleted_warning"],
        "mcp_tools": ["vision.safety.check"],
        "modules": [],
        "tags": ["moderation", "vision", "media", "nsfw-filter", "safety"],
    },
    {
        "id": "bot_referral_engine",
        "name": "Viral Referral & Reward System",
        "headline": "Empower your community to invite friends with unique referral links and rewards.",
        "description": "Generate unique referral tracking links for every user. Tracks multi-tier referrals, calculates conversion commission into wallet credits, and displays real-time referral leaderboards.",
        "category": "community",
        "icon": "share-2",
        "version": "1.2.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": True,
        "rating": 4.93,
        "install_count": 1340,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "database.read_write"],
        "config_schema": {
            "reward_points_per_invite": {"type": "integer", "title": "Points per Verified Invite", "default": 50},
            "min_payout_points": {"type": "integer", "title": "Minimum Points for Reward Claim", "default": 500},
        },
        "default_config": {
            "reward_points_per_invite": 50,
            "min_payout_points": 500,
        },
        "system_templates": ["referral_dashboard", "new_referral_alert", "payout_claimed"],
        "mcp_tools": [],
        "modules": [
            {"id": "module_referral_tracker", "version": "1.0.0"},
        ],
        "tags": ["referrals", "growth", "rewards", "viral", "affiliate"],
    },

    # --------------------------------------------------------------------------
    # 3. AI SPECIALIST BOTS (6 BOTS)
    # --------------------------------------------------------------------------
    {
        "id": "bot_chatgpt_assistant",
        "name": "Custom ChatGPT AI Assistant",
        "headline": "Versatile conversational AI bot powered by GPT-4o and Claude 3.5 Sonnet.",
        "description": "Deploy a personalized AI assistant with custom persona, memory history, and tone. Supports context-aware multi-turn conversations in private chats or tagged inside group discussions.",
        "category": "ai_specialist",
        "icon": "bot",
        "version": "2.1.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": True,
        "rating": 4.98,
        "install_count": 3120,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "ai.completion"],
        "config_schema": {
            "ai_model": {"type": "string", "enum": ["openai/gpt-4o-mini", "openai/gpt-4o", "anthropic/claude-3.5-sonnet", "deepseek/deepseek-chat"], "default": "openai/gpt-4o-mini"},
            "system_prompt": {"type": "string", "title": "System Persona Prompt", "default": "You are a helpful, witty, and concise AI assistant."},
            "temperature": {"type": "number", "title": "Temperature (Creativity)", "default": 0.7},
            "max_tokens": {"type": "integer", "title": "Max Response Tokens", "default": 1000},
        },
        "default_config": {
            "ai_model": "openai/gpt-4o-mini",
            "system_prompt": "You are an intelligent, polite, and executive AI assistant.",
            "temperature": 0.7,
            "max_tokens": 1000,
        },
        "system_templates": ["welcome", "ai_reply", "token_quota_exceeded"],
        "mcp_tools": ["web_search.google", "calculator.math"],
        "modules": [],
        "tags": ["chatgpt", "ai", "assistant", "gpt4", "claude"],
    },
    {
        "id": "bot_pdf_research",
        "name": "PDF Research & Document Analyst",
        "headline": "Drop any PDF, document, or report to get instant summaries and Q&A citations.",
        "description": "Users upload PDF manuals, financial statements, or academic papers. The bot parses text, splits chapters, and provides instant answers with exact page citations.",
        "category": "ai_specialist",
        "icon": "file-text",
        "version": "1.3.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": True,
        "rating": 4.94,
        "install_count": 1820,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "files.download", "ai.completion"],
        "config_schema": {
            "max_file_size_mb": {"type": "integer", "title": "Max PDF Size (MB)", "default": 20},
            "summary_mode": {"type": "string", "enum": ["executive_bullets", "detailed_analysis", "qa_only"], "default": "executive_bullets"},
        },
        "default_config": {
            "max_file_size_mb": 20,
            "summary_mode": "executive_bullets",
        },
        "system_templates": ["welcome", "document_processing", "document_summary", "qa_response"],
        "mcp_tools": ["pdf.text.extract", "vector.semantic.search"],
        "modules": [
            {"id": "module_pdf_parser", "version": "1.0.0"},
            {"id": "module_ai_rag_retriever", "version": "1.0.0"},
        ],
        "tags": ["pdf", "documents", "research", "rag", "summary"],
    },
    {
        "id": "bot_ai_image_generator",
        "name": "AI Image & Art Studio",
        "headline": "Generate photorealistic art, logos, and illustrations directly from chat prompts.",
        "description": "Integrates with modern image generation models. Users type `/imagine a futuristic cyberpunk city` and receive high-resolution generated art with upscale and variation buttons.",
        "category": "ai_specialist",
        "icon": "image",
        "version": "1.2.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.88,
        "install_count": 940,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "ai.image_generation"],
        "config_schema": {
            "default_aspect_ratio": {"type": "string", "enum": ["1:1", "16:9", "9:16"], "default": "1:1"},
            "daily_quota_per_user": {"type": "integer", "title": "Free Daily Generations per User", "default": 5},
        },
        "default_config": {
            "default_aspect_ratio": "1:1",
            "daily_quota_per_user": 5,
        },
        "system_templates": ["welcome", "generating_progress", "image_ready", "quota_reached"],
        "mcp_tools": ["image.generate.dalle", "image.upscale"],
        "modules": [],
        "tags": ["image", "art", "dalle", "stablediffusion", "design"],
    },
    {
        "id": "bot_code_reviewer",
        "name": "Code Reviewer & Bug Explainer",
        "headline": "Paste code snippets to detect security vulnerabilities, optimize, and format.",
        "description": "A developer's best friend on Telegram. Review Python, TypeScript, Go, Rust, or SQL code directly in chat. Detects memory leaks, SQL injection, and offers refactored code blocks.",
        "category": "ai_specialist",
        "icon": "code",
        "version": "1.1.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.90,
        "install_count": 760,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "ai.completion"],
        "config_schema": {
            "default_programming_language": {"type": "string", "default": "Python"},
            "include_security_audit": {"type": "boolean", "title": "Perform OWASP security check", "default": True},
        },
        "default_config": {
            "default_programming_language": "Python",
            "include_security_audit": True,
        },
        "system_templates": ["welcome", "review_result"],
        "mcp_tools": ["ast.code.analyze"],
        "modules": [],
        "tags": ["code", "developer", "bugs", "security", "refactor"],
    },
    {
        "id": "bot_rag_knowledge",
        "name": "Enterprise RAG Knowledge Base",
        "headline": "Query your company's Notion, Google Docs, or internal knowledge base securely.",
        "description": "Connect your company's product docs, employee handbooks, and FAQs. Employees or customers ask questions in natural language and receive verified company knowledge.",
        "category": "ai_specialist",
        "icon": "database",
        "version": "1.4.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": True,
        "rating": 4.96,
        "install_count": 1450,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "ai.completion", "database.read_write"],
        "config_schema": {
            "knowledge_collection_name": {"type": "string", "title": "Vector Collection Name", "default": "corp_kb"},
            "similarity_top_k": {"type": "integer", "title": "Retrieved Document Chunks (Top K)", "default": 4},
            "strict_grounding": {"type": "boolean", "title": "Never hallucinate outside KB context", "default": True},
        },
        "default_config": {
            "knowledge_collection_name": "corp_kb",
            "similarity_top_k": 4,
            "strict_grounding": True,
        },
        "system_templates": ["welcome", "rag_answer", "source_citations", "no_knowledge_fallback"],
        "mcp_tools": ["qdrant.vector.query", "notion.page.fetch"],
        "modules": [
            {"id": "module_ai_rag_retriever", "version": "1.0.0"},
        ],
        "tags": ["rag", "knowledge", "enterprise", "vector", "search"],
    },
    {
        "id": "bot_voice_transcriber",
        "name": "Voice Note Transcriber & Translator",
        "headline": "Convert Telegram voice notes and audio clips into clean text and translations.",
        "description": "Automatically listens to forwarded audio messages and voice notes. Transcribes speech accurately using Whisper and provides instant multi-language translation and bullet point summaries.",
        "category": "ai_specialist",
        "icon": "mic",
        "version": "1.0.8",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.87,
        "install_count": 680,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "files.download", "ai.transcription"],
        "config_schema": {
            "target_translation_language": {"type": "string", "title": "Translate to (or leave original)", "default": "en"},
            "include_summary": {"type": "boolean", "title": "Include 3-bullet summary", "default": True},
        },
        "default_config": {
            "target_translation_language": "en",
            "include_summary": True,
        },
        "system_templates": ["welcome", "transcription_ready"],
        "mcp_tools": ["audio.transcribe.whisper"],
        "modules": [],
        "tags": ["voice", "audio", "transcription", "whisper", "speech-to-text"],
    },

    # --------------------------------------------------------------------------
    # 4. DEVELOPER TOOLS (4 BOTS)
    # --------------------------------------------------------------------------
    {
        "id": "bot_github_notifier",
        "name": "GitHub DevOps Notifier",
        "headline": "Instant alerts for PR reviews, CI/CD pipeline failures, and new releases.",
        "description": "Connect GitHub repositories via webhooks. Team members receive real-time notifications when a PR needs review, builds break, or issues are opened, with quick action buttons.",
        "category": "developer_tools",
        "icon": "git-branch",
        "version": "1.2.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": True,
        "rating": 4.93,
        "install_count": 1270,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "webhooks.receive"],
        "config_schema": {
            "notify_on_pr": {"type": "boolean", "title": "Alert on Pull Requests", "default": True},
            "notify_on_build_fail": {"type": "boolean", "title": "Alert on CI/CD Failures", "default": True},
            "alert_chat_id": {"type": "string", "title": "Destination Channel/Group ID"},
        },
        "default_config": {
            "notify_on_pr": True,
            "notify_on_build_fail": True,
            "alert_chat_id": "",
        },
        "system_templates": ["pr_opened", "ci_failed", "release_published"],
        "mcp_tools": ["github.pr.status", "github.issues.list"],
        "modules": [],
        "tags": ["github", "devops", "ci-cd", "alerts", "git"],
    },
    {
        "id": "bot_uptime_monitor",
        "name": "Server & API Uptime Monitor",
        "headline": "Ping websites, APIs, and SSL certificates with instant downtime notifications.",
        "description": "Monitors your public endpoints every 60 seconds. Checks HTTP response codes, latency spikes, and SSL certificate expiration. Instantly notifies your engineering team upon outage.",
        "category": "developer_tools",
        "icon": "activity",
        "version": "1.3.1",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": True,
        "rating": 4.95,
        "install_count": 1540,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "scheduler.create_job"],
        "config_schema": {
            "check_interval_seconds": {"type": "integer", "enum": [30, 60, 300], "default": 60},
            "monitored_endpoints": {"type": "string", "title": "Endpoints (comma-separated URLs)", "default": "https://api.example.com/health"},
            "alert_on_ssl_expiry_days": {"type": "integer", "title": "Alert when SSL expires in (days)", "default": 14},
        },
        "default_config": {
            "check_interval_seconds": 60,
            "monitored_endpoints": "https://api.example.com/health",
            "alert_on_ssl_expiry_days": 14,
        },
        "system_templates": ["downtime_alert", "recovery_alert", "status_report"],
        "mcp_tools": ["network.http.ping", "network.ssl.inspect"],
        "modules": [],
        "tags": ["uptime", "monitoring", "devops", "ssl", "status"],
    },
    {
        "id": "bot_webhook_dispatcher",
        "name": "Universal Webhook Automation & Dispatcher",
        "headline": "Receive external HTTP webhooks, transform payloads, and post into channels.",
        "description": "A universal webhook router. Send JSON payloads from Stripe, Shopify, Zapier, or internal microservices, format the data using custom message studio templates, and broadcast to Telegram.",
        "category": "developer_tools",
        "icon": "zap",
        "version": "1.1.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.88,
        "install_count": 890,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "webhooks.receive"],
        "config_schema": {
            "webhook_auth_token": {"type": "string", "title": "Webhook Bearer Secret (Leave blank for auto-generate)"},
            "default_parse_mode": {"type": "string", "enum": ["HTML", "MarkdownV2"], "default": "HTML"},
        },
        "default_config": {
            "webhook_auth_token": "",
            "default_parse_mode": "HTML",
        },
        "system_templates": ["webhook_message_default"],
        "mcp_tools": [],
        "modules": [],
        "tags": ["webhooks", "integration", "automation", "api", "router"],
    },
    {
        "id": "bot_database_query",
        "name": "Database Query & Metric Reporter",
        "headline": "Run secure read-only SQL queries to fetch metrics and KPI charts on demand.",
        "description": "Securely connect your read-only PostgreSQL, MySQL, or ClickHouse analytics database. Authorize executives to type `/mrr` or `/active_users` and receive instant metrics in chat.",
        "category": "developer_tools",
        "icon": "terminal",
        "version": "1.0.4",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.84,
        "install_count": 420,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "database.read_only"],
        "config_schema": {
            "query_timeout_seconds": {"type": "integer", "title": "Max Query Timeout", "default": 10},
            "allowed_admin_user_ids": {"type": "string", "title": "Authorized Telegram User IDs (comma-separated)"},
        },
        "default_config": {
            "query_timeout_seconds": 10,
            "allowed_admin_user_ids": "",
        },
        "system_templates": ["query_result", "unauthorized_error"],
        "mcp_tools": ["database.sql.query_readonly"],
        "modules": [],
        "tags": ["database", "sql", "metrics", "analytics", "kpi"],
    },

    # --------------------------------------------------------------------------
    # 5. CONTENT & MEDIA (3 BOTS)
    # --------------------------------------------------------------------------
    {
        "id": "bot_rss_publisher",
        "name": "RSS & Blog Auto-Publisher",
        "headline": "Automatically sync blog posts, YouTube videos, and Substack to Telegram.",
        "description": "Polls your favorite RSS feeds, Substack newsletters, or YouTube channels. When a new article is published, formats an eye-catching card with preview image and link buttons.",
        "category": "content_media",
        "icon": "rss",
        "version": "1.2.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": True,
        "rating": 4.92,
        "install_count": 1410,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "scheduler.create_job"],
        "config_schema": {
            "feed_urls": {"type": "string", "title": "RSS Feed URLs (comma-separated)", "default": "https://techcrunch.com/feed/"},
            "poll_interval_minutes": {"type": "integer", "enum": [5, 15, 30, 60], "default": 15},
            "include_read_more_button": {"type": "boolean", "title": "Include URL Button", "default": True},
        },
        "default_config": {
            "feed_urls": "https://techcrunch.com/feed/",
            "poll_interval_minutes": 15,
            "include_read_more_button": True,
        },
        "system_templates": ["feed_card"],
        "mcp_tools": ["rss.feed.fetch"],
        "modules": [
            {"id": "module_rss_fetcher", "version": "1.0.0"},
        ],
        "tags": ["rss", "news", "publishing", "content", "channels"],
    },
    {
        "id": "bot_news_curator",
        "name": "AI News Curator & Summarizer",
        "headline": "Aggregate news across the web on specific topics and publish 3-minute briefs.",
        "description": "Monitors topics such as Crypto, AI, Stocks, or Global Politics. Scrapes top trending articles, generates an executive summary using AI, and publishes a scheduled daily morning digest.",
        "category": "content_media",
        "icon": "newspaper",
        "version": "1.1.0",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.89,
        "install_count": 910,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "ai.completion", "scheduler.create_job"],
        "config_schema": {
            "news_topic": {"type": "string", "title": "Curated Topic / Keywords", "default": "Artificial Intelligence"},
            "digest_publish_time": {"type": "string", "title": "Daily Publish Time (UTC HH:MM)", "default": "08:00"},
        },
        "default_config": {
            "news_topic": "Artificial Intelligence",
            "digest_publish_time": "08:00",
        },
        "system_templates": ["daily_digest_card"],
        "mcp_tools": ["web_search.google", "ai.summarize"],
        "modules": [],
        "tags": ["news", "digest", "curator", "ai", "content"],
    },
    {
        "id": "bot_watermark_processor",
        "name": "Media Watermark & Branding Processor",
        "headline": "Auto-apply brand watermarks, logos, and caption signatures to uploaded media.",
        "description": "Essential tool for media channel managers. Upload images or video clips and the bot automatically places your semi-transparent logo watermark and formatted copyright signature.",
        "category": "content_media",
        "icon": "sparkles",
        "version": "1.0.5",
        "author": "Platform Core",
        "is_official": True,
        "is_featured": False,
        "rating": 4.81,
        "install_count": 560,
        "supported_channels": ["telegram"],
        "required_permissions": ["messages.send", "files.download", "files.upload"],
        "config_schema": {
            "watermark_position": {"type": "string", "enum": ["bottom_right", "bottom_left", "center"], "default": "bottom_right"},
            "watermark_opacity": {"type": "number", "title": "Opacity (0.1 - 1.0)", "default": 0.75},
        },
        "default_config": {
            "watermark_position": "bottom_right",
            "watermark_opacity": 0.75,
        },
        "system_templates": ["welcome", "media_processed"],
        "mcp_tools": ["image.watermark.apply"],
        "modules": [],
        "tags": ["media", "watermark", "branding", "images", "channels"],
    },
]


# ==============================================================================
# REUSABLE MARKETPLACE MODULES (PLUG-AND-PLAY COMPONENTS)
# ==============================================================================

REUSABLE_MODULES: list[dict[str, Any]] = [
    {
        "id": "module_cart_manager",
        "name": "Interactive Shopping Cart Manager",
        "description": "Multi-item shopping cart state tracking, quantity increment/decrement, and checkout sum calculation.",
        "category": "monetization",
        "version": "1.0.0",
        "icon": "shopping-cart",
        "config_schema": {
            "max_cart_items": {"type": "integer", "default": 20},
            "cart_timeout_minutes": {"type": "integer", "default": 120},
        },
        "is_official": True,
    },
    {
        "id": "module_payment_checkout",
        "name": "Dual Gateway Checkout Engine",
        "description": "Universal payment connector for Razorpay and Stripe with webhook signature verification.",
        "category": "monetization",
        "version": "1.0.0",
        "icon": "credit-card",
        "config_schema": {
            "active_gateway": {"type": "string", "enum": ["razorpay", "stripe", "auto"], "default": "auto"},
        },
        "is_official": True,
    },
    {
        "id": "module_anti_spam_shield",
        "name": "Heuristic Spam & Raid Blocker",
        "description": "Rate-limits rapid message floods and silences suspicious accounts before group infiltration.",
        "category": "security",
        "version": "1.0.0",
        "icon": "shield",
        "config_schema": {
            "strict_mode": {"type": "boolean", "default": True},
        },
        "is_official": True,
    },
    {
        "id": "module_captcha_gate",
        "name": "Multi-Challenge Captcha Gatekeeper",
        "description": "Interactive button and math puzzles to verify human participants.",
        "category": "security",
        "version": "1.0.0",
        "icon": "check-square",
        "config_schema": {
            "kick_on_failure": {"type": "boolean", "default": True},
        },
        "is_official": True,
    },
    {
        "id": "module_ai_rag_retriever",
        "name": "Vector RAG Semantic Retriever",
        "description": "Vector similarity search connector for semantic document QA.",
        "category": "ai",
        "version": "1.0.0",
        "icon": "search",
        "config_schema": {
            "embed_model": {"type": "string", "default": "text-embedding-3-small"},
        },
        "is_official": True,
    },
    {
        "id": "module_pdf_parser",
        "name": "PDF & Document Text Engine",
        "description": "High-speed text and table extraction from uploaded PDF and Word documents.",
        "category": "utility",
        "version": "1.0.0",
        "icon": "file",
        "config_schema": {
            "extract_images": {"type": "boolean", "default": False},
        },
        "is_official": True,
    },
    {
        "id": "module_rss_fetcher",
        "name": "Polled RSS/Atom Feed Reader",
        "description": "Periodic XML feed parser with deduplication and updated item detection.",
        "category": "content",
        "version": "1.0.0",
        "icon": "rss",
        "config_schema": {
            "user_agent": {"type": "string", "default": "SuperBot-RSS/1.0"},
        },
        "is_official": True,
    },
    {
        "id": "module_referral_tracker",
        "name": "Referral Link & Commission Engine",
        "description": "Generates cryptographically signed deep-link tokens and attributes signups.",
        "category": "growth",
        "version": "1.0.0",
        "icon": "share-2",
        "config_schema": {
            "cookie_days": {"type": "integer", "default": 30},
        },
        "is_official": True,
    },
]
