File indexing completed on 2024-12-01 07:41:09

0001 /*
0002    SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqola_private_export.h"
0010 #include "messagesmodel.h"
0011 
0012 class LIBRUQOLACORE_TESTS_EXPORT ThreadMessageModel : public MessagesModel
0013 {
0014     Q_OBJECT
0015 public:
0016     explicit ThreadMessageModel(RocketChatAccount *account = nullptr, QObject *parent = nullptr);
0017     ~ThreadMessageModel() override;
0018 
0019     [[nodiscard]] QString threadMessageId() const;
0020     void setThreadMessageId(const QString &threadMessageId);
0021 
0022     void parseThreadMessages(const QJsonObject &obj);
0023     void loadMoreThreadMessages(const QJsonObject &obj);
0024 
0025     [[nodiscard]] int total() const;
0026     void setTotal(int total);
0027     void setPreviewMessage(const Message &message);
0028 
0029 private:
0030     void parse(const QJsonObject &obj);
0031     Message mPreviewMessage;
0032     QString mThreadMessageId;
0033     int mTotal = 0;
0034 };