package com.fs.qw.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum MessageTypeEnum {
    TEXT(1,"文本"),
    IMAGE(2,"图片"),
    VIDEO(3,"视频"),
    FILE(4,"文件"),
    VOICE(5,"语音"),
    APP(6,"小程序"),
    EMOJI(7,"表情"),
    LINK(8,"链接");

    private Integer value;
    private String desc;

    public static MessageTypeEnum toType(Integer value) {
        return Stream.of(MessageTypeEnum.values())
                .filter(p -> p.value.equals(value))
                .findAny()
                .orElse(null);
    }
}
