/**
 * MCP Apps Index
 * 
 * All 11 MCP apps for Meta Ads server.
 * Each app provides a rich HTML UI via structuredContent.
 */

export * as campaignDashboard from "./campaign-dashboard.js";
export * as adPerformanceGrid from "./ad-performance-grid.js";
export * as creativePreview from "./creative-preview.js";
export * as audienceBuilder from "./audience-builder.js";
export * as funnelAnalyzer from "./funnel-analyzer.js";
export * as spendTracker from "./spend-tracker.js";
export * as abTestResults from "./ab-test-results.js";
export * as performanceHeatmap from "./performance-heatmap.js";
export * as adLibraryBrowser from "./ad-library-browser.js";
export * as campaignBuilder from "./campaign-builder.js";
export * as accountHealth from "./account-health.js";

/**
 * Register all apps with the MCP server
 */
export function registerAllApps(server: any, client: any): void {
  const apps = [
    require("./campaign-dashboard.js"),
    require("./ad-performance-grid.js"),
    require("./creative-preview.js"),
    require("./audience-builder.js"),
    require("./funnel-analyzer.js"),
    require("./spend-tracker.js"),
    require("./ab-test-results.js"),
    require("./performance-heatmap.js"),
    require("./ad-library-browser.js"),
    require("./campaign-builder.js"),
    require("./account-health.js")
  ];

  apps.forEach(app => {
    if (app.register) {
      app.register(server, client);
    }
  });
}

/**
 * App metadata for documentation
 */
export const appMetadata = {
  campaignDashboard: {
    name: "Campaign Dashboard",
    description: "Overview of all campaigns with key metrics and performance",
    icon: "📊"
  },
  adPerformanceGrid: {
    name: "Ad Performance Grid",
    description: "Detailed performance metrics for all ads with color-coded insights",
    icon: "🎯"
  },
  creativePreview: {
    name: "Creative Preview",
    description: "View ad creative across multiple placements",
    icon: "🎨"
  },
  audienceBuilder: {
    name: "Audience Builder",
    description: "Visualize targeting spec with demographics and estimated reach",
    icon: "👥"
  },
  funnelAnalyzer: {
    name: "Funnel Analyzer",
    description: "Visualize conversion funnel from impressions to purchases",
    icon: "🔄"
  },
  spendTracker: {
    name: "Spend Tracker",
    description: "Daily spend visualization with budget pacing and projections",
    icon: "💰"
  },
  abTestResults: {
    name: "A/B Test Results",
    description: "Compare control vs treatment variants with statistical significance",
    icon: "🧪"
  },
  performanceHeatmap: {
    name: "Performance Heatmap",
    description: "Hourly performance visualization across days and hours",
    icon: "🔥"
  },
  adLibraryBrowser: {
    name: "Ad Library Browser",
    description: "Search competitor ads from Facebook Ad Library",
    icon: "📚"
  },
  campaignBuilder: {
    name: "Campaign Builder",
    description: "Multi-step guided campaign creation interface",
    icon: "🎯"
  },
  accountHealth: {
    name: "Account Health Score",
    description: "Comprehensive health assessment with sub-scores and recommendations",
    icon: "💚"
  }
};
