import {
  Workflow,
  Shapes,
  Palette,
  Image as ImageIcon,
  FileText,
  Award,
  Share2,
  Repeat,
} from "lucide-react";
import type { ComponentType } from "react";

/**
 * Phase 10 — single source-of-truth for Studio workshops.
 *
 * The Studio home grid and the workshop detail view both consume this
 * definition. Adding a new workshop means appending an entry here and
 * wiring a component in StudioWorkshopDetail's WORKSHOP_COMPONENTS map.
 */

export type WorkshopSlug =
  | "diagrams"
  | "icons"
  | "themes"
  | "wallpapers"
  | "documents"
  | "brand-kits"
  | "social"
  | "convert";

export interface WorkshopDefinition {
  slug: WorkshopSlug;
  /** Inter 700 uppercase — e.g. "DIAGRAMS". */
  title: string;
  /** Inter 400 silver — single line. */
  subtitle: string;
  /** Lucide icon component, rendered at 32x32 in volt, top-right of the card. */
  icon: ComponentType<{ className?: string }>;
  /**
   * Key used by StudioWorkshopDetail to look up the concrete generator
   * component. Phase 10 does not rewrite any generator internals — each
   * key resolves to one of the existing ContentStudio generator panels,
   * or (for `convert`) to the legacy ConvertPanel folded in from
   * `/convert`.
   */
  componentKey: string;
}

export const WORKSHOPS: WorkshopDefinition[] = [
  {
    slug: "diagrams",
    title: "DIAGRAMS",
    subtitle: "Mermaid → rendered SVG",
    icon: Workflow,
    componentKey: "diagram",
  },
  {
    slug: "icons",
    title: "ICONS",
    subtitle: "SVG sets from description",
    icon: Shapes,
    componentKey: "icon",
  },
  {
    slug: "themes",
    title: "THEMES",
    subtitle: "Color → full palette",
    icon: Palette,
    componentKey: "theme",
  },
  {
    slug: "wallpapers",
    title: "WALLPAPERS",
    subtitle: "Desktop, mobile, banners",
    icon: ImageIcon,
    componentKey: "wallpaper",
  },
  {
    slug: "documents",
    title: "DOCUMENTS",
    subtitle: "PDF reports, invoices",
    icon: FileText,
    componentKey: "document",
  },
  {
    slug: "brand-kits",
    title: "BRAND KITS",
    subtitle: "Full brand identity",
    icon: Award,
    componentKey: "brand",
  },
  {
    slug: "social",
    title: "SOCIAL",
    subtitle: "Platform-ready posts",
    icon: Share2,
    componentKey: "social",
  },
  {
    slug: "convert",
    title: "CONVERT",
    subtitle: "File format conversion",
    icon: Repeat,
    componentKey: "convert",
  },
];

export function findWorkshop(slug: string): WorkshopDefinition | null {
  return WORKSHOPS.find((w) => w.slug === slug) ?? null;
}
