#ifndef CHATMESSAGE_H
#define CHATMESSAGE_H

#include <QDateTime>
#include <QObject>
#include <QString>

namespace ChatConstants {
static constexpr int AVATAR_SIZE = 40;
static constexpr int BUBBLE_PADDING = 12;
static constexpr int BUBBLE_SPACING = 8;
static constexpr int BUBBLE_RADIUS = 8;
static constexpr int TIMESTAMP_HEIGHT = 20;
// static constexpr int MAX_WIDTH = 600;
} // namespace ChatConstants

// 添加消息类型枚举
enum class MessageType {
    Left,   // 接收到的消息
    Right,  // 发送的消息
    System, // 系统消息
    Private // 私聊消息
};

class ChatMessage
{
public:
    QString id;
    QString text;
    QString senderId;
    QString senderName;
    QString roomId;
    QString avatar;
    MessageType type = MessageType::Left;
    QDateTime timestamp = QDateTime::currentDateTime();
    bool isRead = false;

    ChatMessage(const QString &text = QString(),
                MessageType type = MessageType::Left,
                const QDateTime &timestamp = QDateTime::currentDateTime())
        : text(text)
        , type(type)
        , timestamp(timestamp)
    {}
    bool isLeft() const { return type == MessageType::Left; }
    bool isRight() const { return type == MessageType::Right; }
    bool isSystem() const { return type == MessageType::System; }
};

Q_DECLARE_METATYPE(ChatMessage)
#endif // CHATMESSAGE_H
