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

public enum AccTradeTypeEnum {
   RECHARGE(10, "充值"),
   SUBSIDY(20, "补贴"),
   WITHDRAW(30, "提现"),
   CLEAR(100, "清空"),
   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 "";
   }
}
