package com.goafanti.common.enums;

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

public enum ActivityFields {
	ID("id", "活动圈活动ID"),
	NAME("name", "标题"),
	ADDRESS("address", "活动地址"),
	HOST("host", "主办单位"),
	UNDERTAKE("undertake", "承办单位"),
	ASIST("asist", "协办单位"),
	TYPE("type", "活动类型"),
	FORM("form", "活动形式"),
	IMGURLS("imgUrls", "活动图片地址"),
	RESULT("result", "活动结果描述"),
	TITLEURL("titleUrl", "题图地址"),
	OTHER("", "未知参数");

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

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

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

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