import { ComponentType } from '@/models/component.types';
import { DataType } from '@/models/source.types';

// WARNING 模板导出相关ts类型，区别于正常的ComponentConfig,以下类型仅用于模板，大屏，终端导出相关类型
export interface ComponentConfigOfExport {
  actions: string;
  autoUpdate: string;
  base: string;
  config: string;
  dataConfig: string;
  dataType: DataType;
  deleted: 0 | 1; //0 未被删除 1已被删除
  events: string;
  filters: string;
  from: ComponentType;
  id: number;
  isDataConfig: number;
  name: string;
  parent: null | number;
  screenId: number;
  staticData: string;
  triggers: string;
  useFilter: 0 | 1; //0 不使用 1 使用
}

interface ScreenConfigOfExport {
  components: string;
  config: string;
  deleted: 0 | 1; //0 未被删除 1已被删除
  globalFilter: null | string;
  id: number;
  layers: string;
  mobileId: null | number;
  name: string;
  panelId: null | number;
  panels: string;
}

interface FiltersConfigOfExport {
  callbackKeys: string;
  content: string;
  deleted: 0 | 1; //0 未被删除 1已被删除
  id: number;
  name: string;
  screenId: number;
}

interface PanelsConfigOfExport {
  config: {
    config: string;
    deleted: 0 | 1; //0 未被删除 1已被删除
    id: number;
    name: string;
    screenId: number;
    states: string;
    type: number;
  };
  statesConfig: {
    componentsConfig: ComponentConfigOfExport[];
    filtersConfig: FiltersConfigOfExport[];
    panelsConfig: PanelsConfigOfExport[];
    screenConfig: ScreenConfigOfExport;
  };
}

interface TemplateConfigOfExport {
  category: string;
  categoryId: number;
  courseId: number;
  info: string;
  name: string;
  previewThumb: string;
  rank: number;
  thumb: string;
}

export interface TemplateExportResponse {
  componentsConfig: ComponentConfigOfExport[];
  filtersConfig: FiltersConfigOfExport[];
  panelsConfig: PanelsConfigOfExport[];
  screenConfig: ScreenConfigOfExport;
  templateConfig: TemplateConfigOfExport;
}
