package com.hzs.common.core.enums;

import com.hzs.common.core.constant.EnumsPrefixConstants;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description: 产品发货渠道
 * @Author: yuhui
 * @Time: 2022/10/28 9:53
 * @Classname: EShippingChannel
 * @PackageName: com.hzs.common.core.enums
 */
@AllArgsConstructor
@Getter
public enum EShippingChannel {

    TOTAL_WAREHOUSE(1, "总仓发货", 0, EnumsPrefixConstants.E_SHIPPING_CHANNEL + "1"),

    A_PIECE(2, "一件代发", 0, EnumsPrefixConstants.E_SHIPPING_CHANNEL + "2"),

    TOOL_FLOW(3, "工具流", 0, EnumsPrefixConstants.E_SHIPPING_CHANNEL + "3"),

    ;

    private final Integer value;
    private final String label;
    /**
     * 是否启用（0=是,1=否） -- 来源EYesNo
     */
    private final int enable;
    /**
     * 国际化翻译key值
     */
    private final String key;

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