package com.ssyf.ws.constants;

/**
 * 消息类型枚举
 * 定义消息的传输类型
 */
public enum MessageType {
    
    TEXT("text", "文本消息"),
    IMAGE("image", "图片消息"),
    VOICE("voice", "语音消息"),
    VIDEO("video", "视频消息"),
    FILE("file", "文件消息"),
    LOCATION("location", "位置消息"),
    COMMAND("command", "命令消息");
    
    private final String code;
    private final String description;
    
    MessageType(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    public static MessageType getByCode(String code) {
        for (MessageType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return TEXT; // 默认返回文本类型
    }
}