package com.goafanti.common.enums;

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

public enum OrgIntellectualPropertyFields {
	
	UID("uid", "用户id"),
	INTELLECTUALPROPERTYNUMBER("intellectualPropertyNumber", "知识产权编号"),
	INTELLECTUALPROPERTYNAME("intellectualPropertyName", "知识产权名称"),
	SORTNUMBER("sortNumber", "排序号"),
	CATAGORY("catagory", "类别"),
	OBTAINWAY("obtainWay", "获得方式"),
	AUTHORIZATIONNUMBER("authorizationNumber", "授权号"),
	AUTHORIZATIONDATE("authorizationDate", "授权日期"),
	PROPERTYRIGHTURL("propertyRightUrl", "知识产权证书URL"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, OrgIntellectualPropertyFields> status = new HashMap<String, OrgIntellectualPropertyFields>();
	
	private OrgIntellectualPropertyFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (OrgIntellectualPropertyFields value : OrgIntellectualPropertyFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static OrgIntellectualPropertyFields 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;
	}

}
