// Path: src/main/java/me/hao0/wechat/exception/EventException.java
// public class EventException extends RuntimeException {
// 
//     public EventException() {
//         super();
//     }
// 
//     public EventException(String message) {
//         super(message);
//     }
// 
//     public EventException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public EventException(Throwable cause) {
//         super(cause);
//     }
// 
//     protected EventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }


import me.hao0.wechat.exception.EventException;
import java.util.Objects;
package me.hao0.wechat.model.message.receive;



/**
 * 接收微信服务器的消息类型
 * Author: haolin
 * Email: haolin.h0@gmail.com
 * Date: 8/11/15
 */
public enum RecvMessageType {

    TEXT("text", "文本消息"),
    IMAGE("image", "图片消息"),
    VOICE("voice", "语音消息"),
    VIDEO("video", "视频消息"),
    SHORT_VIDEO("shortvideo", "小视频消息"),
    LOCATION("location", "地理位置信息"),
    LINK("link", "链接信息"),
    /**
     * 接收到微信服务器的事件消息:
     *  @see me.hao0.wechat.model.message.receive.event.RecvEventType
     */
    EVENT("event", "事件消息");

    private String value;

    private String desc;

    private RecvMessageType(String value, String desc){
        this.value = value;
        this.desc = desc;
    }

    public String value(){
        return value;
    }

    public String desc(){
        return desc;
    }

    public static RecvMessageType from(String type){
        for (RecvMessageType t : RecvMessageType.values()){
            if (Objects.equals(t.value(), type)){
                return t;
            }
        }
// Path: src/main/java/me/hao0/wechat/exception/EventException.java
// public class EventException extends RuntimeException {
// 
//     public EventException() {
//         super();
//     }
// 
//     public EventException(String message) {
//         super(message);
//     }
// 
//     public EventException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public EventException(Throwable cause) {
//         super(cause);
//     }
// 
//     protected EventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }


// Path: src/main/java/me/hao0/wechat/model/message/receive/RecvMessageType.java
import me.hao0.wechat.exception.EventException;
import java.util.Objects;

package me.hao0.wechat.model.message.receive;



/**
 * 接收微信服务器的消息类型
 * Author: haolin
 * Email: haolin.h0@gmail.com
 * Date: 8/11/15
 */
public enum RecvMessageType {

    TEXT("text", "文本消息"),
    IMAGE("image", "图片消息"),
    VOICE("voice", "语音消息"),
    VIDEO("video", "视频消息"),
    SHORT_VIDEO("shortvideo", "小视频消息"),
    LOCATION("location", "地理位置信息"),
    LINK("link", "链接信息"),
    /**
     * 接收到微信服务器的事件消息:
     *  @see me.hao0.wechat.model.message.receive.event.RecvEventType
     */
    EVENT("event", "事件消息");

    private String value;

    private String desc;

    private RecvMessageType(String value, String desc){
        this.value = value;
        this.desc = desc;
    }

    public String value(){
        return value;
    }

    public String desc(){
        return desc;
    }

    public static RecvMessageType from(String type){
        for (RecvMessageType t : RecvMessageType.values()){
            if (Objects.equals(t.value(), type)){
                return t;
            }
        }
        throw new EventException("unknown message type");