/**
 * scaffold-theme/types.ts — Input contract + generated file shape.
 */
import { z } from 'zod';

export const ThemeTokensSchema = z.object({
  /** Primary accent color hex (e.g. '#3b82f6'). Optional — falls back to SmartStack default. */
  accent: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),
  /** Dark-mode app background hex. Default '#161618'. */
  darkBg: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),
  /** Light-mode app background hex. Default '#ffffff'. */
  lightBg: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),
  /** Border radius scale in px (default 8). */
  radiusCard: z.number().int().min(0).max(64).optional(),
});

export type ThemeTokens = z.infer<typeof ThemeTokensSchema>;

export const ScaffoldThemeInputSchema = z.object({
  projectPath: z.string().min(1),
  appCode: z.string().min(1),
  prdSlice: z
    .object({
      theme: ThemeTokensSchema.optional(),
    })
    .nullable()
    .optional(),
  force: z.boolean().default(false),
  /**
   * Emit the `@shoelace-style/shoelace` light/dark theme imports in
   * `src/index.css`. Defaults to `false` so a project that doesn't ship the
   * package in its `package.json` no longer fails Vite resolution at boot
   * (`Can't resolve '@shoelace-style/shoelace/dist/themes/light.css'`).
   *
   * Set to `true` when the project lists `@shoelace-style/shoelace` as a
   * dependency. ba-develop can flip this on by reading the target project's
   * `package.json` before invoking the CLI.
   */
  useShoelace: z.boolean().default(false),
});

export type ScaffoldThemeInput = z.infer<typeof ScaffoldThemeInputSchema>;

export interface GeneratedFile {
  /** Path relative to projectPath. */
  path: string;
  content: string;
}
