export interface RootUnit { // 一级单元
  key: string;
  data: Array<TemplateProperty | TmplSelectProperty | UnitProperty>;
  type?: number;
  label: string
}

export enum PropertyType {
  None = -1,
  Input = 0, //文本输入
  Image = 1, //图片
  File = 2, //文件
  Unit = 3, // 有下级
  Select = 5, //选择
  Date = 6, //时间戳
  Editor = 7, //编辑器
  Video = 8, //视频
  Audio = 9, // 音频
  TextArea = 10, // 多行文本输入
  Link = 11 //外部链接
}

//to showstatus 
interface Property {
  key: string;
  type: PropertyType;
}

/**
 * 普通字段
 */
export interface TemplateProperty extends Property {
  type: PropertyType.Image;
  value: string | Array<string>;
}

export interface TemInputProperty extends Property {
  type: PropertyType.Input | PropertyType.Date;
  value: string;
  data: object
}
/**
 * 下拉选项字段(单选)
 */
export interface TmplSelectProperty extends Property {
  type: PropertyType.Select;
  options: string[];
  value: string | Array<string>;
}

/**
 * 单元字段
 */
export interface UnitProperty extends Property {
  type: PropertyType.Unit;
  value: Array<TemplateProperty | TmplSelectProperty>; // 包含的子字段数组
}
