package com.freemud.application.sdk.api.ordercenter.enums;

import java.util.Arrays;
import java.util.List;

/**
 * All rights Reserved, Designed By www.freemud.cn
 *
 * @version V1.6.0
 * @Title: ProductTypeEnum
 * @Description: 简单描述下这个类是做什么用的
 * @author: qin.zhou
 * @date: 2019/9/511:34
 * @Copyright: ${DATE.YARE} www.freemud.cn Inc. All rights reserved.
 * 注意：本内容仅限于上海非码科技内部传阅，禁止外泄以及用于其他的商业目
 */
public enum ProductTypeEnum {


    GENERAL_PRODUCT(1,"普通商品"),

    GROUP_PRODUCT(3,"组合商品"),
    SETMEAL_PRODUCT(6,"套餐商品"),
    SETMEAL_UPPRICE_PRODUCT(7,"加价套餐商品"),
    VIRTUAL_PRODUCT(9,"虚拟商品"),
    MORD_SPECIFICATION_PRODUCT(10,"多规格商品"),
    WEIGHT_PRODUCT(11,"称重商品"),
    TABLEWARE_PRODUCT(12,"餐具商品"),
    MATERIAL_PRODUCT(88,"加料商品"),
    LITTLE_MATERIAL_PRODUCT(89,"小料"),
    WITH_ORDER_VIRTUAL_PRODUCT(90,"随单购虚拟商品"),
    ;


    public static List<Integer> getVirtualProductType() {
        return Arrays.asList(VIRTUAL_PRODUCT.getCode(), WITH_ORDER_VIRTUAL_PRODUCT.getCode());
    }

    private Integer code;

    private String msg;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    ProductTypeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static ProductTypeEnum getOrderType(Integer type){
        for (ProductTypeEnum orderType : values()){
            if (type.equals(orderType.code)){
                return orderType;
            }
        }
        return null;
    }

}
