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

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 <QString>
0016 
0017 #include <optional>
0018 
0019 class QJsonObject;
0020 class QJsonValue;
0021 class QJsonArray;
0022 
0023 namespace KGAPI2::People
0024 {
0025 class FieldMetadata;
0026 struct MiscKeywordDefinition;
0027 
0028 /**
0029  * A person's miscellaneous keyword.
0030  *
0031  * @see https://developers.google.com/people/api/rest/v1/people#misckeyword
0032  * @since 5.23.0
0033  **/
0034 class KGAPIPEOPLE_EXPORT MiscKeyword
0035 {
0036 public:
0037     enum class Type {
0038         TYPE_UNSPECIFIED, ///< Unspecified.
0039         OUTLOOK_BILLING_INFORMATION, ///< Outlook field for billing information.
0040         OUTLOOK_DIRECTORY_SERVER, ///< Outlook field for directory server.
0041         OUTLOOK_KEYWORD, ///< Outlook field for keyword.
0042         OUTLOOK_MILEAGE, ///< Outlook field for mileage.
0043         OUTLOOK_PRIORITY, ///< Outlook field for priority.
0044         OUTLOOK_SENSITIVITY, ///< Outlook field for sensitivity.
0045         OUTLOOK_SUBJECT, ///< Outlook field for subject.
0046         OUTLOOK_USER, ///< Outlook field for user.
0047         HOME, ///< Home.
0048         WORK, ///< Work.
0049         OTHER, ///< Other.
0050     };
0051 
0052     /** Constructs a new MiscKeyword **/
0053     explicit MiscKeyword();
0054     MiscKeyword(const MiscKeywordDefinition &definition);
0055     MiscKeyword(const MiscKeyword &);
0056     MiscKeyword(MiscKeyword &&) noexcept;
0057     MiscKeyword &operator=(const MiscKeyword &);
0058     MiscKeyword &operator=(MiscKeyword &&) noexcept;
0059     /** Destructor. **/
0060     ~MiscKeyword();
0061 
0062     bool operator==(const MiscKeyword &) const;
0063     bool operator!=(const MiscKeyword &) const;
0064 
0065     [[nodiscard]] static MiscKeyword fromJSON(const QJsonObject &);
0066     [[nodiscard]] static QList<MiscKeyword> fromJSONArray(const QJsonArray &data);
0067     [[nodiscard]] QJsonValue toJSON() const;
0068 
0069     /** Metadata about the miscellaneous keyword. **/
0070     [[nodiscard]] FieldMetadata metadata() const;
0071     /** Sets value of the metadata property. **/
0072     void setMetadata(const FieldMetadata &value);
0073 
0074     /** The value of the miscellaneous keyword. **/
0075     [[nodiscard]] QString value() const;
0076     /** Sets value of the value property. **/
0077     void setValue(const QString &value);
0078 
0079     /** The miscellaneous keyword type. **/
0080     [[nodiscard]] MiscKeyword::Type type() const;
0081     /** Sets value of the type property. **/
0082     void setType(MiscKeyword::Type value);
0083 
0084     /** Output only. The type of the miscellaneous keyword translated and formatted in the viewer's account locale or the `Accept-Language` HTTP header locale.
0085      * **/
0086     [[nodiscard]] QString formattedType() const;
0087 
0088 private:
0089     class Private;
0090     QSharedDataPointer<Private> d;
0091 }; // MiscKeyword
0092 
0093 } // namespace KGAPI2::People