import {
  AlignRightOutlined,
  BarChartOutlined,
  FieldBinaryOutlined,
  FieldNumberOutlined,
  FieldStringOutlined,
  FieldTimeOutlined,
  KeyOutlined
} from "@ant-design/icons";
import {FieldsNode} from "./atomic/FieldsNode";
import {CardNode} from "./atomic/CardNode";
import {MarkerType} from "@xyflow/react";
import {CustomConnectLine} from "./atomic/CustomConnectLine";
import {DIM_TYPE_ENUM} from "../../constants";

export const WORKFLOW_DEFAULT_STYLE = {
  nodeTypes: {
    fields: FieldsNode,
    table: CardNode
  },
  defaultEdgeOptions: {
    style: {strokeWidth: 2, stroke: 'black'},
    type: 'smoothstep',
    markerEnd: {
      type: MarkerType.ArrowClosed,
      color: 'black',
    },
  },
  connectionLineComponent: CustomConnectLine,
  connectionLineStyle: {
    strokeWidth: 2,
    stroke: 'black',
  }
}

export const CARD_TYPE = {
  MODAL: 'MODAL',
  TABLE: 'TABLE',
};


export const ACTION_TYPES = {
  [CARD_TYPE.MODAL]: [
    {
      key: 'remove',
      label: "移除模型"
    }
  ],
  [CARD_TYPE.TABLE]: [
    {
      key: 'add',
      label: "新增表关联"
    },
    {
      key: 'update',
      label: "更改关联关系"
    },
    {
      key: 'remove',
      label: "移除当前表"
    }
  ],
  CHECK: [
    {
      key: 'update',
      label: "编辑"
    },
    {
      key: 'auth',
      label: "授权管理"
    },
    {
      key: 'detail',
      label: "详情"
    },
    {
      key: 'disPublish',
      label: "取消发布"
    },
    {
      key: 'publish',
      label: "发布指标"
    },
    {
      key: 'remove',
      label: "删除"
    }
  ],
};

export const ICON_TYPE = {
  KEY: <KeyOutlined style={{color: "rgb(215, 5, 104)", marginRight: 10}}/>,
  NUMBER: <FieldNumberOutlined style={{marginRight: 10}}/>,
  STRING: <FieldStringOutlined style={{marginRight: 10}}/>,
  DATETIME: <FieldTimeOutlined style={{marginRight: 10}}/>,
  METRIC:<BarChartOutlined style={{marginRight: 10}}/>,
  BINARY:<FieldBinaryOutlined style={{marginRight: 10}}/>,
  TEXT:<AlignRightOutlined style={{marginRight: 10}}/>
}

export const ICON_MAP = {
  ATOMIC: ICON_TYPE.METRIC,
  DERIVED: ICON_TYPE.METRIC,
  COMPOSITE: ICON_TYPE.METRIC,
  [DIM_TYPE_ENUM.IDENTIFY]: ICON_TYPE.KEY,
  [DIM_TYPE_ENUM.DATETIME]: ICON_TYPE.DATETIME,
  [DIM_TYPE_ENUM.CATEGORICAL]: ICON_TYPE.STRING,
  KEY: ICON_TYPE.KEY,
  INT: ICON_TYPE.NUMBER,
  BIGINT: ICON_TYPE.NUMBER,
  TINYINT:ICON_TYPE.NUMBER,
  DOUBLE: ICON_TYPE.NUMBER,
  DECIMAL: ICON_TYPE.NUMBER,
  VARCHAR: ICON_TYPE.STRING,
  DATETIME: ICON_TYPE.DATETIME,
  DATE:ICON_TYPE.DATETIME,
  TIME:ICON_TYPE.DATETIME,
  BLOB:ICON_TYPE.BINARY,
  TEXT:ICON_TYPE.TEXT
}