package com.goafanti.common.enums;

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

import org.apache.commons.lang3.StringUtils;

public enum PatentInfoStatus {
	CREATE(0, "申请"),
	SIGN(1,"签单"),
	DELIVERD(2, "派单"),
	CIRCULATION(3,"流转"),
	COMPOSE(4, "撰写"),
	ACCEPT(5, "受理"),
	REVIEWNOTICE(6, "审查意见通知"),
	REVIEWREPLY(7, "审查意见答复"),
	CORRECTIONNOTICE(8, "补正通知"),
	CORRECTIONREPLY(9, "补正已答复"),
	AUTHORIZE(10, "授权"),
	REJECT(11, "驳回"),
	LICENSE(12, "发证"),
	SETTLEMENT(13, "已结款"),
	CALLBACK(14, "退单"),
	OTHER(15, "其他");
	
	
	private Integer	code;
	private String	desc;
	
	private PatentInfoStatus(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

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

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

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

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

	

	public Integer getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}
}
