package com.goafanti.common.enums;

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

public enum CopyrightFields {

	UID("uid", "用户id"),
	ACCEPTTIME("acceptTime", "受理时间"),
	PRINCIPAL("principal", "负责人"),
	CONTACT("contact", "联系人"),
	COPYRIGHTINFO("copyrightInfo", "软著简介"),
	COPYRIGHTNAME("copyrightName", "软著名称"),
	STATUS("status", "申请状态"),
	WORKISSUE("workIssue", "派单信息"),
	COMMENT("comment", "备注"),
	OUTSOURCE("outsource", "外包单位"),
	INURGENT("inUrgent", "加急天数"),
	AUTHORIZEDDATE("authorizedDate", "下证日期"),
	RECORDTIME("recordTime", "状态流转时间"),
	SALESMAN("salesman", "营销员"),
	OTHER("", "未知参数");

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

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

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

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