package com.bonus.canteen.core.account.v3.constants;

import cn.hutool.core.collection.ListUtil;

import java.util.ArrayList;
import java.util.List;

public enum AccRechargeSourceEnum {
   WECHAT_SMALL_PRO(1, "微信小程序"),
   WECHAT_OFFACCT(2, "微信公众号"),
   WECHAT_ENTERPRISE(3, "企业微信"),
   ALI_LIFE_CODE(5, "支付宝"),
   ABC_MOBILE(6, "农行掌银"),
   HT_H5_MOBILE(7, "H5"),
   DING_TALK(9, "钉钉"),
   WEB_YST(20, "窗口充值"),
   BUFFET_DEVICE(21, "自助终端"),
   OLD_SYSTEM_IMPORT(22, "老系统导入"),
   OPEN_RECHARGE(30, "OpenApi");

   private final Integer key;
   private final String desc;

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

   public static String getDesc(Integer key) {
      AccRechargeSourceEnum[] var1 = values();
      int var2 = var1.length;

      for(int var3 = 0; var3 < var2; ++var3) {
         AccRechargeSourceEnum temp = var1[var3];
         if (temp.getKey().equals(key)) {
            return temp.getDesc();
         }
      }

      return "";
   }

   public static AccRechargeSourceEnum getEnum(Integer key) {
      AccRechargeSourceEnum[] var1 = values();
      int var2 = var1.length;

      for(int var3 = 0; var3 < var2; ++var3) {
         AccRechargeSourceEnum temp = var1[var3];
         if (temp.getKey().equals(key)) {
            return temp;
         }
      }

      return null;
   }

   public static List<Integer> getAllAppSource() {
      List<Integer> list = new ArrayList();
      list.add(WECHAT_SMALL_PRO.getKey());
      list.add(WECHAT_OFFACCT.getKey());
      list.add(WECHAT_ENTERPRISE.getKey());
      list.add(ALI_LIFE_CODE.getKey());
      list.add(HT_H5_MOBILE.getKey());
      list.add(DING_TALK.getKey());
      list.add(ABC_MOBILE.getKey());
      return list;
   }

   public static List<Integer> getAllWebSource() {
      List<Integer> list = new ArrayList();
      list.add(WEB_YST.getKey());
      list.add(OLD_SYSTEM_IMPORT.getKey());
      return list;
   }

   public static boolean ifAllowWithDraw(Integer key) {
      return ListUtil.toList(new Integer[]{WECHAT_SMALL_PRO.getKey(), WECHAT_OFFACCT.getKey(), WECHAT_ENTERPRISE.getKey(), ALI_LIFE_CODE.getKey(), HT_H5_MOBILE.getKey(), DING_TALK.getKey(), ABC_MOBILE.getKey(), BUFFET_DEVICE.getKey()}).contains(key);
   }

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

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

   // $FF: synthetic method
   private static AccRechargeSourceEnum[] $values() {
      return new AccRechargeSourceEnum[]{WECHAT_SMALL_PRO, WECHAT_OFFACCT, WECHAT_ENTERPRISE, ALI_LIFE_CODE, ABC_MOBILE, HT_H5_MOBILE, DING_TALK, WEB_YST, BUFFET_DEVICE, OLD_SYSTEM_IMPORT, OPEN_RECHARGE};
   }
}
