File indexing completed on 2024-03-03 15:47:11

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolacore_export.h"
0010 #include "ownuserpreferences.h"
0011 #include "servicepassword.h"
0012 #include "user.h"
0013 
0014 class LIBRUQOLACORE_EXPORT OwnUser
0015 {
0016 public:
0017     OwnUser();
0018     ~OwnUser();
0019     void parseOwnUserInfo(const QJsonObject &replyObject);
0020 
0021     [[nodiscard]] QString userId() const;
0022     void setUserId(const QString &userId);
0023 
0024     [[nodiscard]] QString userName() const;
0025     void setUserName(const QString &userName);
0026 
0027     [[nodiscard]] QString status() const;
0028     void setStatus(const QString &status);
0029 
0030     [[nodiscard]] bool operator==(const OwnUser &other) const;
0031 
0032     [[nodiscard]] QString email() const;
0033     void setEmail(const QString &email);
0034 
0035     [[nodiscard]] QString statusText() const;
0036     void setStatusText(const QString &statusText);
0037 
0038     [[nodiscard]] QString name() const;
0039     void setName(const QString &name);
0040 
0041     [[nodiscard]] QString avatarUrl() const;
0042     void setAvatarUrl(const QString &avatarUrl);
0043 
0044     [[nodiscard]] double utcOffset() const;
0045     void setUtcOffset(double utcOffset);
0046 
0047     [[nodiscard]] QString statusDefault() const;
0048     void setStatusDefault(const QString &statusDefault);
0049 
0050     [[nodiscard]] User user() const;
0051 
0052     [[nodiscard]] QString nickName() const;
0053     void setNickName(const QString &nickName);
0054 
0055     [[nodiscard]] QStringList roles() const;
0056     void setRoles(const QStringList &roles);
0057 
0058     [[nodiscard]] bool isAdministrator() const;
0059 
0060     [[nodiscard]] ServicePassword servicePassword() const;
0061     void setServicePassword(const ServicePassword &servicePassword);
0062 
0063     [[nodiscard]] OwnUserPreferences ownUserPreferences() const;
0064     void setOwnUserPreferences(const OwnUserPreferences &ownUserPreferences);
0065 
0066 private:
0067     QString mUserId;
0068     QString mUserName;
0069     QString mStatus;
0070     QString mEmail;
0071     QString mStatusText;
0072     QString mName;
0073     QString mAvatarUrl;
0074     QString mStatusDefault;
0075     QString mNickName;
0076     QStringList mRoles;
0077     ServicePassword mServicePassword;
0078     OwnUserPreferences mOwnUserPreferences;
0079     double mUtcOffset = 0.0;
0080 };
0081 Q_DECLARE_METATYPE(OwnUser)
0082 Q_DECLARE_TYPEINFO(OwnUser, Q_MOVABLE_TYPE);
0083 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const OwnUser &t);