File indexing completed on 2024-05-12 05:04:11
0001 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-FileCopyrightText: 2023 Rishi Kumar <rsi.dev17@gmail.com> 0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 0005 #pragma once 0006 0007 #include <QJsonArray> 0008 #include <QQmlListProperty> 0009 0010 class AbstractAccount; 0011 class AdminAccountInfo; 0012 class Post; 0013 0014 class ReportInfo : public QObject 0015 { 0016 Q_OBJECT 0017 Q_PROPERTY(QString reportId READ reportId NOTIFY reportInfoUpdated) 0018 Q_PROPERTY(bool actionTaken READ actionTaken WRITE setActionTaken NOTIFY actionTakenUpdated) 0019 Q_PROPERTY(QDateTime actionTakenAt READ actionTakenAt NOTIFY reportInfoUpdated) 0020 Q_PROPERTY(QString category READ category NOTIFY reportInfoUpdated) 0021 Q_PROPERTY(QString comment READ comment NOTIFY reportInfoUpdated) 0022 Q_PROPERTY(bool forwarded READ forwarded NOTIFY reportInfoUpdated) 0023 Q_PROPERTY(QDateTime createdAt READ createdAt NOTIFY reportInfoUpdated) 0024 Q_PROPERTY(QDateTime updatedAt READ updatedAt NOTIFY reportInfoUpdated) 0025 Q_PROPERTY(int statusCount READ statusCount NOTIFY reportInfoUpdated) 0026 Q_PROPERTY(int mediaAttachmentCount READ mediaAttachmentCount NOTIFY reportInfoUpdated) 0027 Q_PROPERTY(AdminAccountInfo *filedAccount READ filedAccount NOTIFY reportInfoUpdated) 0028 Q_PROPERTY(AdminAccountInfo *targetAccount READ targetAccount NOTIFY reportInfoUpdated) 0029 Q_PROPERTY(bool assignedModerator READ assignedModerator WRITE setAssignedModerator NOTIFY assignedModeratorUpdated) 0030 Q_PROPERTY(AdminAccountInfo *assignedAccount READ assignedAccount WRITE setAssignedAccount NOTIFY assignedAccountUpdated) 0031 Q_PROPERTY(AdminAccountInfo *actionTakenByAccount READ actionTakenByAccount NOTIFY reportInfoUpdated) 0032 Q_PROPERTY(QQmlListProperty<Post> reportStatus READ reportStatusList NOTIFY reportInfoUpdated) 0033 Q_PROPERTY(QJsonArray rules READ rules NOTIFY reportInfoUpdated) 0034 0035 public: 0036 explicit ReportInfo(QObject *parent = nullptr); 0037 QString reportId() const; 0038 bool actionTaken() const; 0039 void setActionTaken(bool actionTaken); 0040 bool assignedModerator() const; 0041 void setAssignedModerator(bool moderatorAssigned); 0042 QDateTime actionTakenAt() const; 0043 QString category() const; 0044 QString comment() const; 0045 bool forwarded() const; 0046 QDateTime createdAt() const; 0047 QDateTime updatedAt() const; 0048 int statusCount() const; 0049 int mediaAttachmentCount() const; 0050 AdminAccountInfo *filedAccount() const; 0051 AdminAccountInfo *targetAccount() const; 0052 AdminAccountInfo *assignedAccount() const; 0053 void setAssignedAccount(AdminAccountInfo *newAssignedAccount); 0054 AdminAccountInfo *actionTakenByAccount() const; 0055 QList<Post *> reportStatus() const; 0056 QQmlListProperty<Post> reportStatusList() const; 0057 QJsonArray rules() const; 0058 void fromSourceData(const QJsonObject &doc); 0059 void reparentReportInfo(AbstractAccount *parent); 0060 0061 Q_SIGNALS: 0062 void actionTakenUpdated(); 0063 void assignedModeratorUpdated(); 0064 void assignedAccountUpdated(); 0065 void reportInfoUpdated(); 0066 0067 private: 0068 QString m_reportId; 0069 bool m_actionTaken = false; 0070 QDateTime m_actionTakenAt; 0071 QString m_category; 0072 QString m_comment; 0073 bool m_forwarded = false; 0074 bool m_assignedModerator = false; 0075 QDateTime m_createdAt; 0076 QDateTime m_updatedAt; 0077 AdminAccountInfo *m_filedAccount; 0078 AdminAccountInfo *m_targetAccount; 0079 AdminAccountInfo *m_assignedAccount; 0080 AdminAccountInfo *m_actionTakenByAccount; 0081 QList<Post *> m_reportStatus; 0082 QQmlListProperty<Post> m_reportStatusList; 0083 QJsonArray m_rules; 0084 AbstractAccount *m_parent = nullptr; 0085 };