package com.goafanti.common.enums;

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

public enum ContractFields {
	UID("uid", "用户id"),
	TYPE("type", "合同类型"),
	DEPICT("depict", "合同描述"),
	PATENTNUM("patentNum", "专利数量"),
	COPYRIGHTNUM("copyrightNum", "软著数量"),
	COGNIZANCEYEAR("cognizanceYear", "高企认定申请年份"),
	TECHPROJECTNUM("techProjectNum", "科技项目数量"),
	PRINCIPAL("principal", "负责人"),
	COMMENT("comment", "备注"),
	OTHER("", "未知参数");

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

	private static Map<String, ContractFields> status = new HashMap<String, ContractFields>();

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

	public static ContractFields 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);
	}

	private String	code;
	private String	desc;

	public String getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

}
