package com.goafanti.common.enums;

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

public enum PatentCostFields {
	ANNUALFEE("annualFee", "用户id"),
	ANNUALFEESTATE("annualFeeState", "联系人"),
	APPLICATIONFEE("applicationFee", "专利名称"),
	TRIALFEE("trialFee", "专利类别"),
	PRINTINGFEE("printingFee", "专利号/申请号"),
	FUNDS("funds", "专利领域"),
	OTHER("", "未知参数");
	
	
	private String	code;
	private String	desc;
	
	private static Map<String, PatentCostFields> status = new HashMap<String, PatentCostFields>();
	
	private PatentCostFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (PatentCostFields value : PatentCostFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static PatentCostFields getField(String code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return OTHER;
	}
	
	public static String getFieldDesc(String code) {
		return getField(code).getDesc();
	}

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

	public String getDesc() {
		return desc;
	}
}
