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

import cn.hutool.core.collection.ListUtil;

import java.util.Arrays;
import java.util.List;

public enum AccStatusEnum {
   NORMAL(1, "正常"),
   DEACTIVATE(2, "停用"),
   CANCEL(3, "注销"),
   OVERDUE(4, "过期");

   private final Integer key;
   private final String desc;

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

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

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

      return "";
   }

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

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

      return null;
   }

   public static List<Integer> sendMqStatus() {
      return Arrays.asList(DEACTIVATE.getKey(), OVERDUE.getKey());
   }

   public static List<Integer> accStatusForAppWork() {
      return ListUtil.toList(new Integer[]{NORMAL.getKey(), DEACTIVATE.getKey(), OVERDUE.getKey()});
   }

   public static boolean ifNotAllowRechargeRepeal(Integer key) {
      return ListUtil.toList(new Integer[]{CANCEL.getKey()}).contains(key);
   }

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

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

   // $FF: synthetic method
   private static AccStatusEnum[] $values() {
      return new AccStatusEnum[]{NORMAL, DEACTIVATE, CANCEL, OVERDUE};
   }
}
