package com.sikey.wa04.common.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: yuzenghui
 * @Date: 2025/08/14
 * @Description: 聊天消息类型
 */
@AllArgsConstructor
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum MessageTypeFilterEnum {
    /**
     * 语聊文本消息
     */
    CHAT_TEXT_MESSAGE(20, "publish.chat.text"),
    /**
     * 语聊元数据消息，语聊视频消息
     */
    CHAT_VIDEO_MESSAGE(21, "publish.chat.video"),
    /**
     * 语聊元数据消息，语聊语音消息
     */
    CHAT_VOICE_MESSAGE(22, "publish.chat.voice"),
    /**
     * 语聊元数据消息，语聊表情消息
     */
    CHAT_EMOJI_MESSAGE(23, "publish.chat.emoji"),
    /**
     * 语聊元数据消息，语聊图片消息
     */
    CHAT_IMAGE_MESSAGE(24, "publish.chat.image"),

    ;

    @JsonValue
    private final Integer value;
    private final String routingKey;

    /**
     * 根据 value 获取 MessageTypeFilter
     *
     * @param value value
     * @return MessageType
     */
    public static MessageTypeFilterEnum valueOfMsg(Integer value) {
        for (MessageTypeFilterEnum messageType : MessageTypeFilterEnum.values()) {
            if (messageType.value.equals(value)) {
                return messageType;
            }
        }
        return null;
    }
}
