package com.goafanti.order.enums;

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

/**
 * @author Administrator
 *
 */
public enum ProjectType {
//	0 正常 1专利 2软著 3审计 4双软
	/** 未达立项条件 **/
	ZC(0,"通用"),
	/** 等待立项 **/
	ZL(1,"专利 "),
	/** 已立项 **/
	RZ(2,"软著"),
	/** 已结项 **/
	SJ(3,"审计"),
	/** 已撤项 **/
	SR(4,"双软"),
	/** 已撤项 **/
	GX(5,"高新"),
	/** 已撤项 **/
	SB(6,"商标"),
	/** 已撤项 **/
	HY(7,"会员"),
	/** 无效 **/
	INVALID(10, "INVALID");

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

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

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

	static {
		for (ProjectType value : ProjectType.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static ProjectType 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;
	}
}
