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/20 10:46
 * @Classname: EProductAttrType
 * @PackageName: com.hzs.common.core.enums
 */
@AllArgsConstructor
@Getter
public enum EProductAttrType {

    REAL(1, "实物商品", EnumsPrefixConstants.E_PRODUCT_ATTR_TYPE + "1"),

    UN_REAL(2, "虚拟商品", EnumsPrefixConstants.E_PRODUCT_ATTR_TYPE + "2");

    /**
     * 实际值
     */
    private final int value;
    /**
     * 显示标签
     */
    private final String label;

    /**
     * 国际化翻译key值
     */
    private final String key;

    /**
     * 根据值，返回枚举
     *
     * @param value
     * @return
     */
    public static EProductAttrType getEnumByValue(int value) {
        if (REAL.getValue() == value) {
            return REAL;
        } else if (UN_REAL.getValue() == value) {
            return UN_REAL;
        }
        return REAL;
    }
}
