export const FORM_TYPE = {
  ATOMIC: {
    label: '原子指标',
    value: 'ATOMIC',
    color: '#2db7f5',
    description: "基于数据原型的度量值,衡量业务表现,例如销售额"
  },
  DERIVED: {
    label: '派生指标',
    value: 'DERIVED',
    color: '#fa8c16',
    description: "基于单个原子指标扩展,用于在时间维度上扩展,例如销售额同环比"
  },
  COMPOSITE: {
    label: '复合指标',
    value: 'COMPOSITE',
    color: '#fa541c',
    description: "基于多个指标,通过运算表达式重新定义,例如:毛利率=(销售额-成本)/销售额*100%"
  }
}

export const DEFINE_TYPE={
  ATOMIC:"MEASURE",
  DERIVED:"MEASURE",
  COMPOSITE:"METRIC"
}

export const INDEX_TYPE = {
  ATOMIC:"原子指标",
  DERIVED:"派生指标",
  COMPOSITE:"复合指标"
}

export const TASK_STATUS = {
  FAILURE: {
    label:"失败",
    color:'error'
  },
  SUBMITTED_SUCCESS:{
    label:"正在运行",
    color:'volcano'
  },
  RUNNING_EXECUTION:{
    label:"正在运行",
    color:'volcano'
  },
  SUCCESS: {
    label:"已完成",
    color:'success'
  }
}

export const PUBLISH_STATUS = {
  0: "未发布",
  1: "已发布",
}

export const CONFIRM_STATUS = [
  {
    label:"否",
    value:0
  },
  {
    label:"是",
    value:1
  }
]

export const SENSITIVE = {
  0: "低",
  1: "普通",
  2: "高"
}

export const CALC_TYPE = {
  SUM: "汇总",
  COUNT: "计数",
  MAX: "最大值",
  MIN: "最小值",
  AVG: "平均值",
  RATIO_ROLL:"环比",
  RATIO_OVER:"同比",
  COUNT_DISTINCT:"去重计数"
}

export const CALC_TYPE_REVERS = {
  '汇总': "SUM",
  '计数': "COUNT",
  '最大值': "MAX",
  '最小值': "MIN",
  '平均值': "AVG",
  "环比":"RATIO_ROLL",
  "同比":"RATIO_OVER",
  "去重计数":"COUNT_DISTINCT",
}

export const DATA_TYPE = {
  DECIMAL: "数字",
  PERCENT: '百分比',
}

export const INVOKE_TYPE = {
  AUTO: '自动调用',
  MANUAL: '手动调用'
}

export const TIME_MODE = {
  DAY: '天',
  WEEK: '周',
  MONTH: '月',
  YEAR: '年',
}

export const LOGIC_TYPE = {
  "=": "等于",
  "<>": "不等于",
  ">=":"大于等于",
  "<=":"小于等于",
  "IS NULL": "为空",
  "IS NOT NULL": "不为空",
  "LIKE": "包含",
  "NOT LIKE": "不包含",
  "IN":"之内",
  "NOT IN":"之外"
}

export const WHERE_COND = [
  {label: "之内", value: "IN"},
  {label: "之外", value: "NOT_IN"},
  {label: "等于", value: "EQUALS"},
  {label: "之间", value: "BETWEEN"},
  {label: "大于", value: "MORE_THAN"},
  {label: "大于等于", value: "MORE_THAN_EQUALS"},
  {label: "为空", value: "IS_NULL"},
  {label: "不为空", value: "IS_NOT_NULL"},
  {label: "包含", value: "LIKE"},
  {label: "小于", value: "LESS_THAN"},
  {label: "小于等于", value: "LESS_THAN_EQUALS"},
  {label: "不等于", value: "NOT_EQUALS"},
  {label: "存在", value: "EXISTS"}
]

export const TIME_COND = [
  {
    label:"当日",
    value:0
  },
  {
    label:"近3日 (含当日)",
    value:3
  },
  {
    label:"近7日 (含当日)",
    value:7
  },
  {
    label:"近30日 (含当日)",
    value:30
  },
  {
    label:"近365日 (含当日)",
    value:365
  }
]

export const SEN_COLOR_LEVEL = {
  0:"#73d13d",
  1:"#fa8c16",
  2:"#ff4d4f"
}

export const STATUS_COLOR_LEVEL = {
  1:"#73d13d",
  0:"#ff4d4f"
}

export const PERSISTENCE_WAY = [
  {
    label:"增量",
    value:'INC'
  },
  {
    label:"全量",
    value:'ALL'
  }
]

// 获取KEY值
export function GET_KEY(ENUM,value) {
  for (const key in ENUM) {
    if (ENUM[key] === value) {
      return key
    }
  }
}
