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 EvaluateLevelEnum implements IBaseEnum {

    LEVEL_0(0,"未评价",SysConstains.STYLE_DEFAULT),
    LEVEL_1(1,"非常不满意",SysConstains.STYLE_DEFAULT),
    LEVEL_2(2,"不满意", SysConstains.STYLE_DEFAULT),
    LEVEL_3(3,"基本满意",SysConstains.STYLE_DEFAULT),
    LEVEL_4(4,"满意", SysConstains.STYLE_DEFAULT),
    LEVEL_5(5,"完美解决问题", SysConstains.STYLE_DEFAULT),
            ;

    private int value;
    private String desc;
    private String style;

    EvaluateLevelEnum(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 EvaluateLevelEnum getByValue(int value) {
        for (EvaluateLevelEnum e : EvaluateLevelEnum.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 (EvaluateLevelEnum item : EvaluateLevelEnum.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;
    }
}
