/** Types matching the Python SDK spec output exactly. */

export type AccentColor =
  | "purple" | "blue" | "green" | "red" | "yellow"
  | "orange" | "cyan" | "pink" | "indigo";

export type ThemeMode = "dark" | "light" | "auto";
export type NavMode = "tabs" | "sidebar";
export type LayoutMode = "list" | "cards" | "kanban" | "grid" | "tiles" | "calendar" | "checklist";

export type RadiusSize = "none" | "sm" | "md" | "lg" | "full";
export type CardStyle = "flat" | "outlined" | "raised";
export type DensitySize = "compact" | "default" | "comfortable";
export type ContentWidth = "sm" | "md" | "lg" | "full";

export interface AppConfig {
  name: string;
  accent: AccentColor;
  theme: ThemeMode;
  nav: NavMode;
  icon: string | null;
  radius: RadiusSize;
  card_style: CardStyle;
  density: DensitySize;
  content_width: ContentWidth;
  records: RecordSpec[];
}

export interface RecordSpec {
  name: string;
  table: string;
  display: string | null;
  required: string[];
  fields: Record<string, FieldSpec>;
}

export interface FieldSpec {
  type: "text" | "number" | "boolean" | "choice" | "date" | "image" | "link" | "computed";
  choices?: string[] | null;
  colors?: Record<string, string> | null;
  link?: string | null;
  format?: "currency" | "percent" | "rating";
  symbol?: string;
  max?: number;
}

export interface PageSpec {
  name: string;
  type: "list" | "detail" | "form" | "custom";
  record?: string;
  config?: PageConfig;
  components?: ComponentSpec[];
}

export interface PageConfig {
  title?: string;
  subtitle?: string;
  badge?: string;
  sort?: string;
  group_by?: string;
  layout?: LayoutMode;
  icon?: string;
  searchable?: boolean;
}

export interface ComponentSpec {
  type: string;
  [key: string]: unknown;
}

export interface ZuzuSpec {
  app: AppConfig;
  pages: PageSpec[];
  error?: string;
}

/** A data row from the API */
export type DataRow = Record<string, unknown>;

// Re-export generated component types
export type { AnyComponentSpec } from "./_generated/components";
