package com.goafanti.common.enums;

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

public enum LectureCacheKey {
	BIG_SHOT_LECTURE_CACHE_KEY("big_shot_lecture_cache_key", "大咖说页面缓存"),
	LECTURE_DYNAMIC_LIST_CACHE_KEY("lecture_dynamic_list_cache_key", "科技明星页面缓存"),
	LECTURE_LIST_CACHE_KEY("lecture_list_cache_key", "科技讲堂页面缓存"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, LectureCacheKey> status = new HashMap<String, LectureCacheKey>();
	
	private LectureCacheKey(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (LectureCacheKey value : LectureCacheKey.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static LectureCacheKey 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;
	}
}
