package com.mortals.xhx.common.code;

import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 会员等级枚举类
 */
public enum MemberLevelEnum implements IBaseEnum {
    NOT_OPEN(0,"未开启", SysConstains.STYLE_DEFAULT),
    ON_TRIAL(1,"试用客户", SysConstains.STYLE_DEFAULT),
    VIP(2,"VIP客户", SysConstains.STYLE_DEFAULT),
    DESIGNER(3,"设计师", SysConstains.STYLE_DEFAULT),
    ;
    private int value;
    private String desc;
    private String style;

    MemberLevelEnum(int value, String desc, String style) {
        this.value = value;
        this.desc = desc;
        this.style = style;
    }

    @Override
    public int getValue() {
        return this.value;
    }

    @Override
    public String getDesc() {
        return this.desc;
    }

    @Override
    public String getStyle() {
        return this.style;
    }

    public static MemberLevelEnum getByValue(int value) {
        for (MemberLevelEnum e : MemberLevelEnum.values()) {
            if (e.getValue() == value) {
                return e;
            }
        }
        return null;
    }

    public static Map<String,String> getEnumMap(int... eItem) {
        Map<String,String> resultMap= new LinkedHashMap<String,String>();
        for (MemberLevelEnum item : MemberLevelEnum.values()) {
            try{
                boolean hasE = false;
                for (int e : eItem){
                    if(item.getValue()==e){
                        hasE = true;
                        break;
                    }
                }
                if(!hasE){
                    resultMap.put(item.getValue()+"", item.getDesc());
                }
            }catch(Exception ex){
            }
        }
        return resultMap;
    }
}
