1 /*
2    SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
3 
4    SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "libruqolacore_export.h"
10 #include <QDebug>
11 #include <QJsonObject>
12 #include <QString>
13 
14 class LIBRUQOLACORE_EXPORT ServerInfo
15 {
16 public:
17     ServerInfo();
18     ~ServerInfo();
19 
20     void parseServerInfo(const QJsonObject &obj);
21     Q_REQUIRED_RESULT QString arch() const;
22     void setArch(const QString &arch);
23 
24     Q_REQUIRED_RESULT int numberOfCpu() const;
25     void setNumberOfCpu(int numberOfCpu);
26 
27     Q_REQUIRED_RESULT QString platform() const;
28     void setPlatform(const QString &platform);
29 
30     Q_REQUIRED_RESULT QString version() const;
31     void setVersion(const QString &version);
32 
33     Q_REQUIRED_RESULT QString commitAuthor() const;
34     void setCommitAuthor(const QString &commitAuthor);
35 
36     Q_REQUIRED_RESULT QString commitBranch() const;
37     void setCommitBranch(const QString &commitBranch);
38 
39     Q_REQUIRED_RESULT QString commitTag() const;
40     void setCommitTag(const QString &commitTag);
41 
42     Q_REQUIRED_RESULT QString commitSubject() const;
43     void setCommitSubject(const QString &commitSubject);
44 
45     Q_REQUIRED_RESULT QString commitHash() const;
46     void setCommitHash(const QString &commitHash);
47 
48     Q_REQUIRED_RESULT bool operator==(const ServerInfo &other) const;
49 
50     Q_REQUIRED_RESULT QString osRelease() const;
51     void setOsRelease(const QString &osRelease);
52 
53     Q_REQUIRED_RESULT QString nodeVersion() const;
54     void setNodeVersion(const QString &nodeVersion);
55 
56 private:
57     QString mArch;
58     QString mPlatform;
59     QString mVersion;
60     QString mCommitAuthor;
61     QString mCommitBranch;
62     QString mCommitTag;
63     QString mCommitSubject;
64     QString mCommitHash;
65     QString mOsRelease;
66     QString mNodeVersion;
67     // TODO Build Date
68     int mNumberOfCpu = -1;
69 };
70 Q_DECLARE_METATYPE(ServerInfo)
71 Q_DECLARE_TYPEINFO(ServerInfo, Q_MOVABLE_TYPE);
72 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const ServerInfo &t);
73 
74