/**
 * R7UXB-005: Single source of truth for the Content hub cell definitions.
 *
 * Both ContentHub.tsx and RecoverHub.tsx encode the same five Content cells
 * (Inventory · Briefs · Calendar · Recovery Runs · Reports). Any future label,
 * route, or gating change only needs to happen here.
 *
 * Usage:
 *   import { CONTENT_CELLS } from './content-hub-cells';
 *
 * Each consumer picks the cells it needs from the shared array and applies
 * its own count-accessor mapping.
 */
import { BookOpen, CalendarDays, FileBarChart, PenLine, Wand2 } from 'lucide-react';

import { RUN_NOUNS } from '@/lib/actionLexicon';
import type { SiteBasic } from '@/types';

export interface ContentHubCellDef {
  key: string;
  title: string;
  ctaLabel: string;
  description: string;
  routeName: string;
  icon: typeof PenLine;
  /** Returns true when the cell is gated (no analysis run). */
  gatedBy?: (site: SiteBasic & { has_analysis: boolean }) => boolean;
  gatedReason?: string;
}

/**
 * The five Content cells in canonical display order.
 * Consumers extract counts from their own page-props shape.
 */
export const CONTENT_CELLS: ContentHubCellDef[] = [
  {
    key: 'content-inventory',
    title: 'Content inventory',
    ctaLabel: 'Open inventory',
    description: 'Everything published — by status and freshness.',
    routeName: 'content-inventory.index',
    icon: BookOpen,
  },
  {
    key: 'content-briefs',
    title: 'Content briefs',
    ctaLabel: 'Open briefs',
    description: 'SERP-grounded briefs ready for the editor.',
    routeName: 'content-briefs.index',
    icon: PenLine,
  },
  {
    key: 'calendar',
    title: 'Calendar',
    ctaLabel: 'Open calendar',
    description: 'Plan and schedule upcoming content.',
    routeName: 'calendar.index',
    icon: CalendarDays,
  },
  {
    key: 'batch-ai',
    title: RUN_NOUNS.manualRunPage,
    ctaLabel: `Open ${RUN_NOUNS.manualRunPage}`,
    description: 'AI rewrite drafts for many declining pages — one run.',
    routeName: 'batch-ai.index',
    icon: Wand2,
    gatedBy: (site) => !site.has_analysis,
    gatedReason: 'Run an analysis to start a Recovery Run.',
  },
  {
    key: 'reports',
    title: 'Reports',
    ctaLabel: 'Open Reports',
    description: 'Shareable before-after lift reports.',
    routeName: 'sites.reports.index',
    icon: FileBarChart,
    gatedBy: (site) => !site.has_analysis,
    gatedReason: 'Run an analysis to publish reports.',
  },
];
