File indexing completed on 2024-05-12 05:22:26

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Daniel Vrátil <dvratil@kde.org>
0003  * SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@kde.org>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-only
0006  * SPDX-License-Identifier: LGPL-3.0-only
0007  * SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL
0008  */
0009 
0010 #pragma once
0011 
0012 #include <QSharedDataPointer>
0013 #include "kgapipeople_export.h"
0014 
0015 #include <QDate>
0016 #include <QString>
0017 
0018 #include <optional>
0019 
0020 class QJsonObject;
0021 class QJsonValue;
0022 class QJsonArray;
0023 
0024 namespace KGAPI2::People
0025 {
0026 class FieldMetadata;
0027 
0028 /**
0029  * An event related to the person.
0030  *
0031  * @see https://developers.google.com/people/api/rest/v1/people#event
0032  * @since 5.23.0
0033  **/
0034 class KGAPIPEOPLE_EXPORT Event
0035 {
0036 public:
0037     /** Constructs a new Event **/
0038     explicit Event();
0039     Event(const Event &);
0040     Event(Event &&) noexcept;
0041     Event &operator=(const Event &);
0042     Event &operator=(Event &&) noexcept;
0043     /** Destructor. **/
0044     ~Event();
0045 
0046     bool operator==(const Event &) const;
0047     bool operator!=(const Event &) const;
0048 
0049     [[nodiscard]] static Event fromJSON(const QJsonObject &obj);
0050     [[nodiscard]] static QList<Event> fromJSONArray(const QJsonArray &data);
0051     [[nodiscard]] QJsonValue toJSON() const;
0052 
0053     /** Metadata about the event. **/
0054     [[nodiscard]] FieldMetadata metadata() const;
0055     /** Sets value of the metadata property. **/
0056     void setMetadata(const FieldMetadata &value);
0057 
0058     /** The date of the event. **/
0059     [[nodiscard]] QDate date() const;
0060     /** Sets value of the date property. **/
0061     void setDate(const QDate &value);
0062 
0063     /** The type of the event. The type can be custom or one of these predefined values: * `anniversary` * `other` **/
0064     [[nodiscard]] QString type() const;
0065     /** Sets value of the type property. **/
0066     void setType(const QString &value);
0067 
0068     /** Output only. The type of the event translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale. **/
0069     [[nodiscard]] QString formattedType() const;
0070 
0071 private:
0072     class Private;
0073     QSharedDataPointer<Private> d;
0074 }; // Event
0075 
0076 } // namespace KGAPI2::People