package com.hzs.common.core.enums;

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

/**
 * 订单状态
 */
@AllArgsConstructor
@Getter
public enum EOrderStatus {

    /**
     * 0=待付款
     */
    WAIT_PAY(0, "待付款", 0, EnumsPrefixConstants.ORDER_STATUS + "0"),

    /**
     * 1=待发货
     */
    PAY(1, "待发货", 0, EnumsPrefixConstants.ORDER_STATUS + "1"),

    /**
     * 2=已合单
     */
    SHIPPING(2, "已合单", 0, EnumsPrefixConstants.ORDER_STATUS + "2"),

    /**
     * 3=待收货
     */
    DELIVERED(3, "待收货", 0, EnumsPrefixConstants.ORDER_STATUS + "3"),

    /**
     * 4=已关闭
     */
    CANCEL(4, "已关闭", 0, EnumsPrefixConstants.ORDER_STATUS + "4"),

    /**
     * 5=已收货
     */
    RECEIVED(5, "已收货", 0, EnumsPrefixConstants.ORDER_STATUS + "5"),

    ;

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

    public static EOrderStatus getEOrderStatus(int value) {
        for (EOrderStatus eOrderStatus : EOrderStatus.values()) {
            if (eOrderStatus.value == value) {
                return eOrderStatus;
            }
        }
        return null;
    }

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

}
