package com.hzs.common.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 预售状态
 */
@AllArgsConstructor
@Getter
public enum EPresaleStatus {

    /**
     * 在售
     */
    ON_SALE(0, "在售", 0),

    /**
     * 预售
     */
    PRESALE(1, "预售", 0),

    /**
     * 缺货
     */
    OUT_STOCK(3, "缺货", 0),

    ;

    /**
     * 实际值
     */
    private final int value;
    /**
     * 显示标签
     */
    private final String label;
    /**
     * 是否启用（0=是,1=否） -- 来源EYesNo
     */
    private final int enable;

    public static EPresaleStatus getEPresaleStatus(int value) {
        for (EPresaleStatus ePresaleStatus : EPresaleStatus.values()) {
            if (ePresaleStatus.getValue() == value) {
                return ePresaleStatus;
            }
        }
        return null;
    }

    public static String getLabelByValue(Integer value) {
        if (null == value) {
            return "";
        }
        for (EPresaleStatus enums : EPresaleStatus.values()) {
            if (enums.getValue() == value) {
                return enums.getLabel();
            }
        }
        return "";
    }

}
