package com.hzs.common.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 产品发货渠道
 */
@AllArgsConstructor
@Getter
public enum EShippingChannel {

    TOTAL_WAREHOUSE(1, "总仓发货", 0),

    A_PIECE(2, "一件代发", 0),

    ;

    private final Integer value;
    private final String label;
    /**
     * 是否启用（0=是,1=否） -- 来源EYesNo
     */
    private final int enable;

    /**
     * 根据值，返回枚举
     *
     * @param value
     * @return
     */
    public static EShippingChannel getEnumByValue(int value) {
        for (EShippingChannel eShippingChannel : EShippingChannel.values()) {
            if (eShippingChannel.getValue() == value) {
                return eShippingChannel;
            }
        }
        return TOTAL_WAREHOUSE;
    }


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

}
