File indexing completed on 2024-12-08 04:33:10

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 <QDebug>
0011 class LIBRUQOLACORE_TESTS_EXPORT Discussion
0012 {
0013     Q_GADGET
0014 public:
0015     Discussion();
0016     Discussion(const Discussion &other) = default;
0017 
0018     [[nodiscard]] QString description() const;
0019     void setDescription(const QString &description);
0020 
0021     [[nodiscard]] QString parentRoomId() const;
0022     void setParentRoomId(const QString &parentRoomId);
0023 
0024     [[nodiscard]] int numberMessages() const;
0025     void setNumberMessages(int numberMessages);
0026 
0027     [[nodiscard]] qint64 lastMessage() const;
0028     void setLastMessage(qint64 lastMessage);
0029 
0030     [[nodiscard]] bool operator==(const Discussion &other) const;
0031     Discussion &operator=(const Discussion &other) = default;
0032 
0033     void parseDiscussion(const QJsonObject &o);
0034 
0035     [[nodiscard]] QString discussionRoomId() const;
0036     void setDiscussionRoomId(const QString &discussionRoomId);
0037 
0038     [[nodiscard]] QString lastMessageDisplay() const;
0039 
0040     [[nodiscard]] qint64 timeStamp() const;
0041     void setTimeStamp(qint64 timeStamp);
0042 
0043     [[nodiscard]] QString timeStampDisplay() const;
0044 
0045     [[nodiscard]] QString fname() const;
0046     void setFname(const QString &fname);
0047 
0048     [[nodiscard]] const QString &userName() const;
0049     void setUserName(const QString &newUserName);
0050 
0051 private:
0052     QString mDescription;
0053     QString mParentRoomId;
0054     QString mDiscussionRoomId;
0055     QString mLastMessageDateTimeStr;
0056     QString mTimeStampDateTimeStr;
0057     QString mFname;
0058     QString mUserName;
0059     int mNumberMessages = 0;
0060     qint64 mLastMessage = -1;
0061     qint64 mTimeStamp = -1;
0062 };
0063 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const Discussion &t);
0064 Q_DECLARE_TYPEINFO(Discussion, Q_RELOCATABLE_TYPE);