package com.qs.mp.common.enums;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.IEnum;

/**
 * @auther zhongcp
 * @create 2022 2022/3/7 2:30 下午
 * @describe
 */
public enum CoinLogTypeEnum implements IEnum<Integer> {

  PRIZE(1, "盲票奖品"),
  EXCHANGE(2, "兑换商品"),
  MARKETING(3,"营销活动"),
  RECOVERY(4,"商品兑换");


  private final int value;
  private final String desc;
  public static final int INCOME = 1;   //收支类型 1收入
  public static final int EXPENSES = 0;  //0支出

  CoinLogTypeEnum(int value, String desc) {
    this.value = value;
    this.desc = desc;
  }

  public static CoinLogTypeEnum getCoinLogTypeEnum(int value) {
    for (CoinLogTypeEnum coinLogTypeEnum : CoinLogTypeEnum.values()) {
      if (coinLogTypeEnum.getValue() == value) {
        return coinLogTypeEnum;
      }
    }
    return null;
  }

  @Override
  public Integer getValue() {
    return value;
  }

  public String getDesc() {
    return desc;
  }

  @Override
  public String toString() {
    JSONObject object = new JSONObject();
    object.put("value", value);
    object.put("desc", desc);
    return object.toString();
  }
}
