File indexing completed on 2024-12-15 03:44:59

0001 /*
0002     SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef KUSERFEEDBACK_CONSOLE_PRODUCT_H
0008 #define KUSERFEEDBACK_CONSOLE_PRODUCT_H
0009 
0010 #include "schemaentry.h"
0011 
0012 #include <QMetaType>
0013 #include <QSharedDataPointer>
0014 #include <QVector>
0015 
0016 class QString;
0017 
0018 namespace KUserFeedback {
0019 namespace Console {
0020 
0021 class Aggregation;
0022 class ProductData;
0023 
0024 /** Product data. */
0025 class Product
0026 {
0027 public:
0028     Product();
0029     Product(const Product&);
0030     ~Product();
0031     Product& operator=(const Product&);
0032 
0033     bool isValid() const;
0034 
0035     QString name() const;
0036     void setName(const QString &name);
0037 
0038     QVector<SchemaEntry> schema() const;
0039     void setSchema(const QVector<SchemaEntry>& schema);
0040     SchemaEntry schemaEntry(const QString &name) const;
0041 
0042     QVector<Aggregation> aggregations() const;
0043     void setAggregations(const QVector<Aggregation> &aggregations);
0044 
0045     void addTemplate(const Product &tpl);
0046 
0047     QByteArray toJson() const;
0048     static QVector<Product> fromJson(const QByteArray &data);
0049 
0050 private:
0051     QSharedDataPointer<ProductData> d;
0052 
0053 };
0054 
0055 }
0056 }
0057 
0058 Q_DECLARE_TYPEINFO(KUserFeedback::Console::Product, Q_MOVABLE_TYPE);
0059 Q_DECLARE_METATYPE(KUserFeedback::Console::Product)
0060 
0061 #endif // KUSERFEEDBACK_CONSOLE_PRODUCT_H