package com.tmerclub.cloud.product.constant;

/**
 * 虚拟商品核销次数枚举类
 * @author gaozijie
 * @date 2023-07-20
 */
public enum WriteOfNumEnum {
    /**
     * 多次核销
     */
    REPEATEDLY(-1, "多次核销"),

    /**
     * 无需核销
     */
    WITHOUT(0, "无需核销"),

    /**
     * 单次核销
     */
    SINGLE(1, "单次核销");

    private final Integer num;
    private final String name;

    WriteOfNumEnum(Integer num, String name) {
        this.num = num;
        this.name = name;
    }

    public Integer getNum() {
        return num;
    }

    public String getName() {
        return name;
    }

    public static String getNameByNum(Integer num) {
        for (WriteOfNumEnum writeOfNumEnum : values()) {
            if (writeOfNumEnum.num.equals(num)) {
                return writeOfNumEnum.name;
            }
        }
        return null;
    }
}
