package com.goafanti.common.enums;

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

import org.apache.commons.lang3.StringUtils;

public enum BusinessCategoryModule {
	
	KJ(0,"科技服务"), 
	ZC(1,"知识产权服务"),
	GX(2,"高新技术企业服务"),
	JM(3,"军民融合"),
	ZX(4,"科技咨询"),
	XM(5,"科技项目");
	

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

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

	static {
		for (BusinessCategoryModule value : BusinessCategoryModule.values()) {
			status.put(value.getCode(), value);
		}
	}

	public static BusinessCategoryModule getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return KJ;
	}

	public static BusinessCategoryModule getStatus(String code) {
		if (StringUtils.isNumeric(code)) {
			return getStatus(Integer.parseInt(code));
		}
		return KJ;
	}

	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}

	private Integer	code;
	private String	desc;

	public Integer getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

}
