package com.goafanti.message.enums;

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

public enum RecommendType {
	/** 科技服务 **/
	TECH_SERVICE(0,"TECH_SERVICE"),
	/** 成果 **/
	ACHIEVEMENT(1,"ACHIEVEMENT"),
	/** 个人成果 **/
	PERSON_ACHIEVEMENT(11,"PERSON_ACHIEVEMENT"),
	/** 组织成果 **/
	ORGANIZATION_ACHIEVEMENT(12,"ORGANIZATION_ACHIEVEMENT"),
	/** 需求 **/
	DEMAND(2,"DEMAND"),
	/** 个人需求 **/
	PERSONAL_DEMAND(21,"PERSONAL_DEMAND"),
	/** 个人需求 **/
	ORGANIZATION_DEMAND(22,"ORGANIZATION_DEMAND"),
	/** 专家 **/
	EXPERT(3,"EXPERT"),
	/** 政策 **/
	NEWS(4,"NEWS"),
	/** 未定义 **/
	NO_DEFINITION(null,"NO_DEFINITION");
	private Integer	typeCode;

	private String	typeName;

	private RecommendType(Integer typeCode,String typeName){
		this.typeCode = typeCode;
		this.typeName = typeName;
	}
	public Integer getTypeCode() {
		return typeCode;
	}

	public void setTypeCode(Integer typeCode) {
		this.typeCode = typeCode;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public RecommendType getField(Integer code){
		if(recommends.containsKey(code)) return recommends.get(code);
		return NO_DEFINITION;
	}
	
	public static Map<Integer,RecommendType> recommends = new HashMap<Integer, RecommendType>();
	
	static {
		for(RecommendType value : RecommendType.values()){
			recommends.put(value.getTypeCode(), value);
		}
	}
	
	public static boolean containsType(int code){
		return recommends.containsKey(code);
	}
}
