package com.goafanti.order.enums;

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

public enum CommodityType {
	/** 科技服务 **/
	SERVICE(0,"科技服务 "),
	/** 科技成果 **/
	ACHIEVEMENT(1,"科技成果"),
	/** 科技需求 **/
	DEMAND(2,"科技需求"),
	/** 专家邀约  **/
	EXPERT(3,"专家邀约"),
	/** 活动报名 **/
	ACTIVITY(4,"活动报名"),
	/** 会员升级 **/
	MEMBER(5,"会员升级"),
	/** 咨询师 **/
	CONSULTANT(6,"咨询师"),
	/** 无效 **/
	INVALID(10, "无效");
	private CommodityType(Integer typeCode, String typeName) {
		this.typeCode = typeCode;
		this.typeName = typeName;
	}

	private static Map<Integer, CommodityType> types = new HashMap<Integer, CommodityType>();

	static {
		for (CommodityType value : CommodityType.values()) {
			types.put(value.getTypeCode(), value);
		}
	}
	public static CommodityType getTypeCode(Integer typeCode) {
		if (containsType(typeCode)) {
			return types.get(typeCode);
		}
		return INVALID;
	}
	public static boolean containsType(Integer typeCode) {
		return types.containsKey(typeCode);
	}
	private Integer	typeCode;
	private String	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;
	}
}
