package com.mortals.xhx.common.code;

import com.mortals.framework.common.IBaseEnum;

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

public enum PublishStatusEnum implements IBaseEnum{

	PRODUCT_PENDING(0, "待发布"),
	PRODUCT_AUDITING(1, "审核中"),
	PRODUCT_SUCESS(2, "审核通过"),
	PRODUCT_REJECT(3, "审核拒绝");

    private int value;
    private String desc;

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

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

    public String getDesc() {
        return desc;
    }

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

}
