File indexing completed on 2024-11-24 04:44:41

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
0003  * SPDX-License-Identifier: LGPL-2.0-or-later
0004  */
0005 
0006 #ifndef KTESTCERTIFICATE_H
0007 #define KTESTCERTIFICATE_H
0008 
0009 #include "khealthcertificate_export.h"
0010 #include "khealthcertificatetypes.h"
0011 
0012 #include <QDate>
0013 #include <QUrl>
0014 
0015 class KTestCertificatePrivate;
0016 
0017 /** A test certificate. */
0018 class KHEALTHCERTIFICATE_EXPORT KTestCertificate
0019 {
0020     KHEALTHCERTIFICATE_GADGET(Test)
0021     KHEALTHCERTIFICATE_PROPERTY(QString, name, setName)
0022     KHEALTHCERTIFICATE_PROPERTY(QDate, dateOfBirth, setDateOfBirth)
0023     KHEALTHCERTIFICATE_PROPERTY(QDate, date, setDate)
0024     KHEALTHCERTIFICATE_PROPERTY(QString, disease, setDisease)
0025     /** The type of test, such as PCR or antigen. */
0026     KHEALTHCERTIFICATE_PROPERTY(QString, testType, setTestType)
0027     /** The test manufacturer/product used. */
0028     KHEALTHCERTIFICATE_PROPERTY(QString, testName, setTestName)
0029     /** URL pointing to further information about the test product. */
0030     KHEALTHCERTIFICATE_PROPERTY(QUrl, testUrl, setTestUrl)
0031     KHEALTHCERTIFICATE_PROPERTY(QString, resultString, setResultString)
0032     KHEALTHCERTIFICATE_PROPERTY(QString, testCenter, setTestCenter)
0033     /** Country the certificate was issued in, as ISO 3166-1 alpha 2 code. */
0034     KHEALTHCERTIFICATE_PROPERTY(QString, country, setCountry)
0035     /** The entity that issued this certificate. */
0036     KHEALTHCERTIFICATE_PROPERTY(QString, certificateIssuer, setCertificateIssuer)
0037     /** The unique identifier of this certificate. */
0038     KHEALTHCERTIFICATE_PROPERTY(QString, certificateId, setCertificateId)
0039     /** Date/time this certificate has been issued at. */
0040     KHEALTHCERTIFICATE_PROPERTY(QDateTime, certificateIssueDate, setCertificateIssueDate)
0041     /** Date/time this certificate expires. */
0042     KHEALTHCERTIFICATE_PROPERTY(QDateTime, certificateExpiryDate, setCertificateExpiryDate)
0043     /** Validation status of the cryptographic signature of this certificate. */
0044     KHEALTHCERTIFICATE_PROPERTY(KHealthCertificate::SignatureValidation, signatureState, setSignatureState)
0045 
0046     Q_PROPERTY(KHealthCertificate::CertificateValidation validationState READ validationState)
0047 
0048     enum Result {
0049         Unknown,
0050         Negative,
0051         Positive,
0052     };
0053     Q_ENUM(Result)
0054     KHEALTHCERTIFICATE_PROPERTY(Result, result, setResult)
0055 
0056     /** Indicates whether the result is still current. */
0057     Q_PROPERTY(bool isCurrent READ isCurrent)
0058 
0059     /** Fully encoded data as represented in the barcode. */
0060     KHEALTHCERTIFICATE_PROPERTY(QByteArray, rawData, setRawData)
0061 public:
0062     KHealthCertificate::CertificateValidation validationState() const;
0063 
0064     bool isCurrent() const;
0065 };
0066 
0067 Q_DECLARE_METATYPE(KTestCertificate)
0068 
0069 #endif // KTESTCERTIFICATE_H