package com.goafanti.common.enums;

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

public enum ContractLogFields {
	
	CID("cid", "合同ID"),
	STATUS("status", "合同流转状态"),
	COMMENT("comment", "备注"),
	OTHER("", "未知参数");

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

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

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

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

}
