package com.goafanti.common.enums;

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

public enum LectureFields {
	ID("id", "科技讲堂ID"),
	UID("uid", "用户ID"),
	NAME("name", "讲堂名称"),
	SUMMARY("summary", "简介"),
	
	LECTUREURL("lectureUrl", "讲堂URL"),
	HOT("hot", "大咖说页面展示标记"),
	DYNAMIC("dynamic", "科技明星页面展示标记"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, LectureFields> status = new HashMap<String, LectureFields>();
	
	private LectureFields(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (LectureFields value : LectureFields.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static LectureFields 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;
	}

}
