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;

/**
 * @author zhangkaikai
 * @create 2023-06-12 3:10 PM
 **/

@JSONType(deserializer = EnumValueDeserializer.class)
public enum UserRedPkgStatusEnum implements IEnum<Integer> {
    UN_DRAW(0,"未领取"),
    DRAW(1, "已领取"),
    ;

    private final Integer value;
    private final String desc;

    UserRedPkgStatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

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

    /**
     * 重写toString，单个转化成json
     *
     * @return
     */
    @Override
    public String toString() {
        JSONObject object = new JSONObject();
        object.put("value", value);
        object.put("desc", desc);
        return object.toString();
    }
}
