package com.hzs.common.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 供应方式
 */
@AllArgsConstructor
@Getter
public enum ESupplyWay {

    /**
     * 自营
     */
    SELF(0, "自营", 0),

    /**
     * 非自营
     */
    NO_SELF(1, "非自营", 0),

    ;

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

    public static ESupplyWay getESupplyWay(int value) {
        for (ESupplyWay eSupplyWay : ESupplyWay.values()) {
            if (eSupplyWay.value == value) {
                return eSupplyWay;
            }
        }
        return null;
    }

    public static String getLabelByVal(Integer value) {
        if (null == value) {
            return "";
        }
        for (ESupplyWay eSupplyWay : ESupplyWay.values()) {
            if (eSupplyWay.getValue() == value) {
                return eSupplyWay.getLabel();
            }
        }
        return "";
    }

}
