package com.ywt.mg.domain.models.enums;

public enum NutrimealOrderTypeEnum {

    UNKNOWN("未知订单类型", 0),
    DELIVERY("配送", 1),
    DOGGY_BAG("堂食", 2),// 原到店自取
    DINE_IN_SHOP("堂食", 3);
    private String name;
    private int value;

    NutrimealOrderTypeEnum(String name, int value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public int getValue() {
        return value;
    }

    public static String getDisplayName(int value) {
        for (NutrimealOrderTypeEnum typeEnum : NutrimealOrderTypeEnum.values()) {
            if (typeEnum.value == value) {
                return typeEnum.name;
            }
        }
        return "";
    }

    public static NutrimealOrderTypeEnum valueOf(int value) {
        for (NutrimealOrderTypeEnum typeEnum : NutrimealOrderTypeEnum.values()) {
            if (typeEnum.value == value) {
                return typeEnum;
            }
        }
        return UNKNOWN;
    }

    /**
     * 是否堂食
     */
    public static boolean isDiningInShop(int value) {
        return valueOf(value) == DINE_IN_SHOP || valueOf(value) == DOGGY_BAG;
    }

    /**
     * 是否配送
     */
    public static boolean isDelivery(int value) {
        return valueOf(value) == DELIVERY;
    }
}
