package com.bonus.core.common.enums;

import cn.hutool.core.collection.CollUtil;

import java.util.List;

public enum MetadataModelTypeEnum {
   ACC("acc", "账户配置"),
   ATTENDANCE("Attendance", "考勤配置"),
   CUSTOMER("customer", "人员配置"),
   CUSTOMER_FACE("customer", "人员-人脸特征值配置"),
   DELIVERY("delivery", "配送配置"),
   DEVICE("device", "设备配置"),
   DEVICE_CABINET("device", "设备-取餐柜配置"),
   DEVICE_WEIGHT("device", "设备-计量主机配置"),
   DEVICE_CONSUME("device", "设备-消费机配置"),
   ENTERPRISE_CODE("enterpriseCode", "支付宝企业码"),
   MARKETING("supermarket", "商超配置"),
   MEALTIME("mealtime", "餐次配置"),
   MENU("menu", "菜品菜谱配置"),
   MERCHANT("merchant", "商家配置"),
   MOBILE("mobile", "移动端配置"),
   MOBILE_COMMON("mobile", "移动端通用配置"),
   NOTICE("notice", "通知配置"),
   NOTICE_PRINT("notice", "通知-打印配置"),
   NUTRITION("nutrition", "营养模块配置"),
   ORDER("order", "订单配置"),
   ORDER_CHARGEBACK("order", "订单-退单配置"),
   ORDER_RESERVE("order", "订单-订餐配置"),
   ORDER_DELIVERY("order", "订单-配送配置"),
   PAY("pay", "支付配置"),
   PAY_ALIPAY("pay", "支付-支付宝配置"),
   PAY_WECHATPAY("pay", "支付-微信配置"),
   PAY_WECHATPAY_SCORE("pay", "支付-微信支付分配置"),
   PAY_SHOUQIANBA("pay", "支付-收钱吧配置"),
   PAY_UNIONPAY_QUICK("pay", "支付-银联云闪付配置"),
   PAY_ABC("pay", "支付-农业银行配置"),
   PAY_ICBC("pay", "支付-工商银行配置"),
   PAY_OTHER("pay", "支付-其他支付配置"),
   REPORT("report", "报表配置"),
   REPORT_DATA_SCREEN("report", "数据大屏"),
   DRP_SUPPLIER_SCORE("drp", "出入库-供应商评分"),
   DRP("drp", "出入库");

   private final String key;
   private final String desc;

   public boolean supportSeparated() {
      return CollUtil.contains(supportSeparatedTypes(), this.key);
   }

   public static List<String> supportSeparatedTypes() {
      return CollUtil.toList(new String[]{MEALTIME.getKey(), DELIVERY.getKey(), ORDER.getKey(), PAY.getKey()});
   }

   public static String modelKeyOfSeparatedType(String key) {
      if (DELIVERY.getKey().equals(key)) {
         return "ifEnableDelivery";
      } else if (ORDER.getKey().equals(key)) {
         return "ifEnableOrder";
      } else if (PAY.getKey().equals(key)) {
         return "ifEnablePay";
      } else {
         return MEALTIME.getKey().equals(key) ? "ifEnableMealtime" : "";
      }
   }

   private MetadataModelTypeEnum(String key, String desc) {
      this.key = key;
      this.desc = desc;
   }

   public String getKey() {
      return this.key;
   }

   public String getDesc() {
      return this.desc;
   }

   // $FF: synthetic method
   private static MetadataModelTypeEnum[] $values() {
      return new MetadataModelTypeEnum[]{ACC, ATTENDANCE, CUSTOMER, CUSTOMER_FACE, DELIVERY, DEVICE, DEVICE_CABINET, DEVICE_WEIGHT, DEVICE_CONSUME, ENTERPRISE_CODE, MARKETING, MEALTIME, MENU, MERCHANT, MOBILE, MOBILE_COMMON, NOTICE, NOTICE_PRINT, NUTRITION, ORDER, ORDER_CHARGEBACK, ORDER_RESERVE, ORDER_DELIVERY, PAY, PAY_ALIPAY, PAY_WECHATPAY, PAY_WECHATPAY_SCORE, PAY_SHOUQIANBA, PAY_UNIONPAY_QUICK, PAY_ABC, PAY_ICBC, PAY_OTHER, REPORT, REPORT_DATA_SCREEN, DRP_SUPPLIER_SCORE, DRP};
   }
}
