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;

/**
 * 流程部署状态
 *
 * @author: zxfei
 * @date: 2021/8/28 20:21
 */
public enum PlatformStatus implements IBaseEnum {
	UNPUBLISH(1, "未部署", SysConstains.STYLE_DEFAULT),
	PUBLISH(2, "已部署", SysConstains.STYLE_DEFAULT),
	DISABLE(3, "停用", SysConstains.STYLE_DEFAULT);
    private int value;
    private String desc;
    private String style;

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

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

    public String getDesc() {
        return desc;
    }

    public String getStyle()
	{
		return style;
	}

	public static PlatformStatus getByValue(int value) {
        for (PlatformStatus examStatus : PlatformStatus.values()) {
            if (examStatus.getValue() == value) {
                return examStatus;
            }
        }
        return null;
    }
	/**
	 * 获取Map集合
	 * @param eItem 不包含项
	 * @return
	 */
	public static Map<String,String> getEnumMap(int... eItem) {
		Map<String,String> resultMap= new LinkedHashMap<String,String>();
		for (PlatformStatus item : PlatformStatus.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;
	}
}
