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

public enum AccTradeTypeEnum {
   RECHARGE(10, "充值"),
   RECHARGE_GIFT(11, "赠送"),
   REVOKE_RECHARGE_GIFT(12, "撤销赠送"),
   REVOKE_RECHARGE(40, "撤销充值"),
   SUBSIDY(20, "补贴"),
   REVOKE_SUBSIDY(50, "撤销补贴"),
   CLEAR(100, "清空"),
   LUCK_MONEY(140, "红包发放"),
   WITHDRAW(30, "提现"),
   TRANSFER_OUT(60, "转出"),
   TRANSFER_IN(70, "转入"),
   FREEZE(80, "冻结"),
   UN_FREEZE(90, "解冻"),
   CONSUME(110, "消费"),
   CONSUME_REPAIR(120, "消费补扣"),
   CONSUME_REFUND(130, "消费退款");

   private final Integer key;
   private final String desc;

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

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

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

   public static String getDescByKey(Integer targetKey) {
      for (AccTradeTypeEnum tradeType : AccTradeTypeEnum.values()) {
         if (tradeType.getKey().equals(targetKey)) {
            return tradeType.getDesc();
         }
      }
      return "";
   }
}
