// 每个组件 demo 的配置格式
export interface PropDoc {
  name: string;
  type: string;
  required?: boolean;
  default?: string;
  desc: string;
}

export interface ComponentVariant {
  name: string;
  label: string;
  testId?: string;
  code: string;
}

export interface ComponentDemo {
  id: string;
  title: string;
  description: string;
  imports: string;
  props: PropDoc[]; // 完整 props 表，所有 variant 共用
  variants: ComponentVariant[];
}

// ─── Canvas ───────────────────────────────────────────────────────

export interface CanvasItem {
  id: string; // nanoid 生成的唯一 ID
  componentType: string; // "PieChart" | "BarChart" | "NumCard" | ...
  code: string; // 当前 TSX 代码
}

// ─── Multi-Canvas ────────────────────────────────────────────────────────

export interface SavedCanvas {
  id: string;
  name: string;
  items: CanvasItem[];
  layout: import('react-grid-layout').LayoutItem[];
  publishedPageCode: string | null;
  publishedAt: number | null; // epoch ms, null = never published
  createdAt: number;
  updatedAt: number;
}
