package com.goafanti.common.enums;

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

public enum StarCacheKey {
	BIG_SHOT_STAR_CACHE_KEY("big_shot_star_cache_key", "大咖说科技明星列表缓存"),
	
	OTHER("", "未知参数");
	
	private String	code;
	private String	desc;
	
	private static Map<String, StarCacheKey> status = new HashMap<String, StarCacheKey>();
	
	private StarCacheKey(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	static {
		for (StarCacheKey value : StarCacheKey.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static StarCacheKey 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;
	}
}
