/**
 * Project-scoped design kit selection + customization (starter presets).
 * Persisted under fs_projects.data.designKit — see /api/projects/[id]/design-kit.
 */

export type DesignKitDensity = "compact" | "comfortable";

export type DesignKitFontPreset = "inter" | "system";

/**
 * Which component stack this preset targets when scaffolding or extending UI.
 * Distinct from visual tokens — shadcn, MUI, HeroUI, and Untitled are different
 * products (install model, APIs, licensing).
 */
export type UiFoundationId =
  | "shadcn-ui"
  | "mui-material"
  | "heroui"
  | "untitled-ui"
  | "agnostic";

export const UI_FOUNDATION_LABELS: Record<UiFoundationId, string> = {
  "shadcn-ui": "shadcn/ui · Radix · Tailwind",
  "mui-material": "MUI (Material UI)",
  heroui: "HeroUI · Next.js",
  "untitled-ui": "Untitled UI · React Aria · Tailwind",
  agnostic: "Tokens only — match your existing stack",
};

/** User-authored deltas applied on top of a starter kit's defaults. */
export interface DesignKitOverrides {
  accentHex?: string;
  /** Mid-step radius in px; xs/sm/xl derived from this */
  radiusMdPx?: number;
  fontPreset?: DesignKitFontPreset;
  density?: DesignKitDensity;
}

export interface DesignSystemDefinition {
  id: string;
  name: string;
  tagline: string;
  hasPreview?: boolean;
  defaults: DesignKitOverrides;
  /** Customize panel fields shown for this starter */
  customizeFields: Array<"accent" | "radius" | "font" | "density">;
  uiFoundation: UiFoundationId;
  /** Short guidance for the coding agent (stack, licensing, when not to add libs). */
  foundationNotesForAi: string;
}

export type StarterKitDefinition = DesignSystemDefinition;

/** Persisted JSON shape */
export interface DesignKitPersisted {
  kitId: string;
  /** Overrides keyed by kit id so switching kits preserves each setup */
  perKit: Record<string, DesignKitOverrides>;
}

export const DEFAULT_DESIGN_KIT_ID = "apple";
