package com.sonic.pigeon.lib.enums;

import lombok.Getter;

@Getter
public enum MessageTypeEnum {

    TEXT(0, "文本消息"),
    IMAGE(1, "图片消息"),
    VOICE(2, "语音消息"),
    VIDEO(3, "视频消息"),
    GEO(4, "地理位置消息"),
    FILE(6, "文件消息"),
    NOTIFY(10, "提示消息"),
    CUSTOM(100, "自定义消息"),

    ;


    private int code;

    private String desc;

    MessageTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static MessageTypeEnum getByCode(int code) {
        for (MessageTypeEnum value : values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }

}
