// application
export interface CronModel {
  appId: string;
  cron: string;
}

export interface applicationModel {
  id?: string;
  name?: string;
  description?: string;
  identify?: string;
  logo?: string;
  path?: string;
  published?: boolean | number;
  sceneId?: string;
  createBy?: string;
  createTime?: string | number;
  updateBy?: string;
  updateTime?: string | number;
  compNum?: number;
  instanceNum?: number;
  nodeNum?: number;
  cron?: string;
  scheduled?: number;
  createUser?: string;
  instanceId?: string | number;
}

export interface queryParams {
  sceneId?: string;
  resId?: string;
  name?: string;
  currPage?: number;
  pageSize?: number;
  total?: number;
}

export interface apiResData {
  list: applicationModel[];
}

export interface FlowDefinition {
  id: string;
  lineConfigs: any[];
  nodeConfigs: any[];
  name?: string;
}

export interface appFlowModel {
  id?: string;
  name?: string;
  compIds?: string[];
  description?: string;
  nodeNum?: number;
  main?: FlowDefinition;
  subs?: any;
}

export interface publishType {
  appId?: string;
  flowId?: string;
  isMain?: number;
  name?: string;
  published?: number | string;
  tag?: string;
  description?: string;
}

export interface publishApi {
  appId: string;
  needAuthor: number;
  time?: number;
}

export interface paramsT {
  code: number;
  msg: string;
  data?: any;
  traceId: string | null;
}

export interface flowType {
  id: string;
  type?: string;
}

// aichat
export interface RecommendResponse {
  code: number;
  compent_list: string[];
}

// dashboard
export interface ContentDataRecord {
  x: string;
  y: number;
}

export interface PopularRecord {
  key: number;
  clickNumber: string;
  title: string;
  increases: number;
}

// scene
export interface monitorCfg {
  label: string;
  url: string;
}

export interface sceneModel {
  id?: string;
  name?: string;
  description?: string;
  identify?: string;
  logo?: string;
  published?: boolean | number;
  createBy?: string;
  createTime?: string;
  updateBy?: string;
  updateTime?: string;
  createUser?: string;
  configUrls?: Array<monitorCfg>;
}

export interface querySceneParams {
  currPage?: number;
  name?: string;
  pageSize?: number;
}

export interface sceneApiResData {
  list: sceneModel[];
  totalCount: number;
}

// user
export interface LoginRes {
  token: string;

  [key: string]: any;
}

export interface authParams {
  domain: string;
  path: string;
}

export interface getTokenParams extends authParams {
  authCode: string;
  callbackUrl: string;
}

export interface getLinkParams {
  callbackUrl: string;
}

export interface UserState {
  account: string;
  avatar?: string;
  realName: string;
  userId: string;
  username: string;
}

// message
export interface MessageRecord {
  id: number;
  type: string;
  title: string;
  subTitle: string;
  avatar?: string;
  content: string;
  time: string;
  status: 0 | 1;
  messageType?: number;
}

export type MessageListType = MessageRecord[];

export interface MessageStatus {
  ids: number[];
}

export interface ChatRecord {
  id: number;
  username: string;
  content: string;
  time: string;
  isCollect: boolean;
}

// event
export interface AddEventParams {
  name: string,
  topic: string,
  description: string,
  sceneId: string,
}

export interface DeleteEventParams {
  id: string;
}

export interface DeleteEventForAppParams {
  appId: string,
  eventIds: string[]
}

// runtime
export interface StepRunEventParams {
  eventId: string;
}

export interface ExecuteCurrentEventParams {
  appId: string,
  nodeId: string,
  socketId: string
}

export interface ReconnectRunParams {
  instanceId: string,
  newSocketId: string
}