package com.iformall.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Stormeye on 2018/08/09.
 */
public enum EnumBusiness {

    // 0:无, 1:餐饮, 2:娱乐, 3:服饰, 4:亲子, 5:超市, 6:其他
    BUSINESS_NULL(0, "无"),
    BUSINESS_ID1(1, "餐饮"),
    BUSINESS_ID2(2, "娱乐"),
    BUSINESS_ID3(3, "服饰"),
    BUSINESS_ID4(4, "亲子"),
    BUSINESS_ID5(5, "超市"),
    BUSINESS_ID6(6, "其它"),
    BUSINESS_ID7(7, "美妆"),
    BUSINESS_ID8(8, "珠宝"),
    BUSINESS_ID9(9, "服务"),
    BUSINESS_ID10(10, "家居"),
    BUSINESS_ID11(11, "数码家电"),

    ;
    private static Map<Integer,EnumBusiness> map = new HashMap<Integer,EnumBusiness>();
    static {
        for (EnumBusiness value : values()) {
            map.put(value.code, value);
        }
    }

    public static EnumBusiness getEnum(Integer code) {
        if (code == null) return null;
        return map.get(code);
    }

    public static String getEnumMessage(Integer code) {
        if (code == null) return null;
        if (map.get(code) == null)
            return null;
        return map.get(code).getMessage();
    }

    private Integer code;
    private String message;


    EnumBusiness(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
