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

0001 /*
0002    SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolacore_export.h"
0010 #include <QDebug>
0011 
0012 class LIBRUQOLACORE_EXPORT ModerationInfo
0013 {
0014 public:
0015     ModerationInfo();
0016     ~ModerationInfo() = default;
0017 
0018     [[nodiscard]] bool operator==(const ModerationInfo &other) const;
0019 
0020     void parseModerationInfo(const QJsonObject &replyObject);
0021 
0022     [[nodiscard]] QString userId() const;
0023     void setUserId(const QString &newUserId);
0024 
0025     [[nodiscard]] QString name() const;
0026     void setName(const QString &newName);
0027 
0028     [[nodiscard]] QString userName() const;
0029     void setUserName(const QString &newUserName);
0030 
0031     [[nodiscard]] QString msgId() const;
0032     void setMsgId(const QString &newMsgId);
0033 
0034     [[nodiscard]] int count() const;
0035     void setCount(int newCount);
0036 
0037     [[nodiscard]] bool isUserDeleted() const;
0038     void setIsUserDeleted(bool newIsUserDeleted);
0039 
0040     [[nodiscard]] QString message() const;
0041     void setMessage(const QString &newMessage);
0042 
0043     [[nodiscard]] const QString &createAtDisplayDateTime() const;
0044 
0045     [[nodiscard]] qint64 createdAt() const;
0046     void setCreatedAt(qint64 newCreatedAt);
0047 
0048     [[nodiscard]] QStringList roomList() const;
0049     void setRoomList(const QStringList &newRoomName);
0050 
0051 private:
0052     LIBRUQOLACORE_NO_EXPORT void parseRoomList(const QJsonArray &rooms);
0053     QStringList mRoomList;
0054     QString mUserId;
0055     QString mName;
0056     QString mUserName;
0057     QString mMsgId;
0058     QString mMessage;
0059     QString mCreateAtDisplayDateTime;
0060     qint64 mCreatedAt = -1;
0061     int mCount = 0;
0062     bool mIsUserDeleted = false;
0063 };
0064 
0065 Q_DECLARE_METATYPE(ModerationInfo)
0066 Q_DECLARE_TYPEINFO(ModerationInfo, Q_RELOCATABLE_TYPE);
0067 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const ModerationInfo &t);