package com.goafanti.common.enums;

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

import org.apache.commons.lang3.StringUtils;

public enum NoticeStatus {
	PATENTINFO(1, "专利申请管理"),
	COGNIZANCE(2, "高企认定管理"),
	COPYRIGHT(3, "软著申请管理"),
	TECHPROJECT(4, "科技项目申报管理"),
	PERSONALCERTIFY(5, "个人用户认证审核"),
	ORGANIZATIONCERTIFY(6, "团体组织用户认证审核"),
	CONTRACT(7, "合同管理"),
	PERSONALDEMAND(8, "个人用户科技需求管理"),
	ORGANIZATIONDEMAND(9, "团体组织用户需求管理"),
	PERSONALACHIEVEMENTT(10, "个人用户科技需求管理"),
	ORGANIZATIONACHIEVEMENT(11, "组织用户科技成果管理"),
	ORDER_CHANGE_ADD(12,"订单变更信息添加"),
	ORDER_CHANGE_UDPATE(13,"订单变更信息修改"),
	OTHER(12, "其他");

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

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

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

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

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

	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;
	}

}
