package com.goafanti.common.enums;

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

public enum VideoFields {
	
	NAME("name", "视频名称"),
	URL("url", "视频地址"),
	TYPE("type", "视频类型"),
	COVERURL("coverUrl", "封面"),
	SUMMARY("summary", "简介"),
	STATUS("status", "状态"),
	OTHER("", "未知参数");

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

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

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

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


}
