#ifndef CHATMESSAGEMODEL_H
#define CHATMESSAGEMODEL_H

#include <QAbstractListModel>
#include <QVector>
#include "chatmessage.h"

class ChatMessageModel : public QAbstractListModel
{
    Q_OBJECT

public:
    explicit ChatMessageModel(QObject *parent = nullptr);

    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

    void addMessage(const ChatMessage &message);
    void clear();

private:
    QVector<ChatMessage> m_messages;
};

#endif // CHATMESSAGEMODEL_H
