package com.qs.mp.common.enums;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.qs.mp.common.json.EnumValueDeserializer;

/**
 * @auther zhongcp
 * @create 2022 2022/3/7 2:30 下午
 * @describe
 */
@JSONType(deserializer = EnumValueDeserializer.class)
public enum ChannelWithdrawStatusEnum implements IEnum<Integer> {

  WITHDRAWING(1, "待提现"),
  FINISHED(2, "已完成"),
  FAILED(3, "提现失败");


  private final int value;
  private final String desc;

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

  public static ChannelWithdrawStatusEnum getChannelWithdrawStatusEnum(int value) {
    for (ChannelWithdrawStatusEnum channelMoneyTypeEnum : ChannelWithdrawStatusEnum.values()) {
      if (channelMoneyTypeEnum.getValue() == value) {
        return channelMoneyTypeEnum;
      }
    }
    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();
  }
}
