package com.goafanti.order.enums;

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

/**
 * @author Administrator
 *
 */
public enum NewProjectTypeEnum {
//	项目类型 0=其他，1=高新会员，2=简单会员，3=单边会员
	/** 未达立项条件 **/
	OTHEN(0,"其他"),
	/** 等待立项 **/
	HT(1,"标准会员 "),
	/** 已立项 **/
	SIMPLE(2,"简单会员"),
	/** 已结项 **/
	UNILATERAL(3,"单边会员"),
	/** 无效 **/
	INVALID(10, "INVALID");

	private NewProjectTypeEnum(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	private static Map<Integer, NewProjectTypeEnum> status = new HashMap<Integer, NewProjectTypeEnum>();

	public static String getValueByCode(Integer code){
        for(NewProjectTypeEnum projectType: NewProjectTypeEnum.values()){
            if(code.equals(projectType.getCode())){
                return projectType.getDesc();
            }
        }
        return  null;
    }

	static {
		for (NewProjectTypeEnum value : NewProjectTypeEnum.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static NewProjectTypeEnum getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return INVALID;
	}
	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}
	private Integer	code;
	private String	desc;
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
}
