package com.ruoyi.yunxin.enums;

import lombok.Getter;

/**
 * 0=文本消息,1=图片消息,2=语音消息,3=视频消息,4=发送地理位置消息,6=发送文件消息,10=发送提示消息,100=发送第三方自定义消息
 * <p>created on 2024/1/29 21:10</p>
 * @author 77
 */
@Getter
public enum YxImTypeEnum {
    TXT(0,"文本消息"),
    IMAGE(1,"图片消息"),
    VOICE(2,"语音消息"),
    VIDEO(3,"视频消息"),
    GIS(4,"发送地理位置消息"),
    FILE(6,"发送文件消息"),
    NOTICE(10,"发送提示消息"),
    CUSTOM(100,"发送第三方自定义消息"),
    ;
    private final Integer code;
    private final String text;

    YxImTypeEnum(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public boolean isFileType(){
        if(this.getCode().equals(1) || this.getCode().equals(2) || this.getCode().equals(3)){
            return true;
        }
        return false;
    }

    public static YxImTypeEnum getByCode(Integer code) {
        for (YxImTypeEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}
