package com.bonus.canteen.core.account.v3.metadata.enums;

import cn.hutool.core.collection.ListUtil;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public enum AccWalletIdEnum {
   WALLET(1, "个人钱包"),
   SUBSIDY(2, "补贴钱包"),
   LUCK_MONEY(4, "红包");

   private final Integer key;
   private final String desc;

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

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

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

      return "";
   }

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

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

      return null;
   }

   public static Map<Integer, AccWalletIdEnum> getEnumMap() {
      return (Map)Arrays.stream(values()).collect(Collectors.toMap(AccWalletIdEnum::getKey, Function.identity()));
   }

   public static List<Integer> checkAccCancelWallet() {
      return Arrays.asList(WALLET.getKey(), SUBSIDY.getKey());
   }

   public static String getAllWalletId() {
      List<Integer> list = new ArrayList();
      AccWalletIdEnum[] var1 = values();
      int var2 = var1.length;

      for(int var3 = 0; var3 < var2; ++var3) {
         AccWalletIdEnum temp = var1[var3];
         list.add(temp.getKey());
      }

      return StringUtils.join(list, ",");
   }

   public static List<Integer> getAllWalletIdList() {
      List<Integer> list = new ArrayList();
      AccWalletIdEnum[] var1 = values();
      int var2 = var1.length;

      for(int var3 = 0; var3 < var2; ++var3) {
         AccWalletIdEnum temp = var1[var3];
         list.add(temp.getKey());
      }

      return list;
   }

   public static boolean ifSupportOpenRecharge(Integer walletId) {
      return ListUtil.toList(new Integer[]{WALLET.getKey(), SUBSIDY.getKey()}).contains(walletId);
   }

   public static boolean iFCorrectWalletId(Integer key) {
      List<Integer> list = new ArrayList();
      AccWalletIdEnum[] var2 = values();
      int var3 = var2.length;

      for(int var4 = 0; var4 < var3; ++var4) {
         AccWalletIdEnum temp = var2[var4];
         list.add(temp.getKey());
      }

      return list.contains(key);
   }

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

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

   // $FF: synthetic method
   private static AccWalletIdEnum[] $values() {
      return new AccWalletIdEnum[]{WALLET, SUBSIDY, LUCK_MONEY};
   }
}
