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 ChannelMoneyEnum implements IEnum<Integer> {

  COMMISSION(1, "佣金收入"),
  WITHDRAW(2, "余额提现"),
  WITHDRAW_FEE(3, "提现手续费"),
  PURCHASE(4, "进票"),
  COUPON(5, "优惠券核销结算"),
  WITHDRAW_BACK(6, "余额提现退回");


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

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

  public static ChannelMoneyEnum getChannelMoneyTypeEnum(int value) {
    for (ChannelMoneyEnum channelMoneyTypeEnum : ChannelMoneyEnum.values()) {
      if (channelMoneyTypeEnum.getValue() == value) {
        return channelMoneyTypeEnum;
      }
    }
    return null;
  }

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


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