/*
   SPDX-FileCopyrightText: 2020-2026 Laurent Montel <montel@kde.org>

   SPDX-License-Identifier: LGPL-2.0-or-later
*/

#pragma once

#include "librocketchatrestapi-qt_export.h"
#include "restapiabstractjob.h"
class QDebug;
namespace RocketChatRestApi
{
class LIBROCKETCHATRESTAPI_QT_EXPORT UserBaseJob : public RestApiAbstractJob
{
    Q_OBJECT
public:
    enum class UserInfoType : uint8_t {
        Unknown,
        UserId,
        UserName,
    };
    Q_ENUM(UserInfoType);

    struct LIBROCKETCHATRESTAPI_QT_EXPORT UserInfo {
        QString userIdentifier;
        UserBaseJob::UserInfoType userInfoType = UserBaseJob::UserInfoType::Unknown;
    };
    explicit UserBaseJob(QObject *parent = nullptr);
    ~UserBaseJob() override;

    [[nodiscard]] UserInfo userInfo() const;
    void setUserInfo(const UserInfo &userInfo);

    [[nodiscard]] bool hasUserIdentifier() const;

    [[nodiscard]] QString identifier() const;

protected:
    void addQueryUrl(QUrl &url) const;
    void generateJson(QJsonObject &jsonObj) const;
    UserInfo mUserInfo;
};
}
LIBROCKETCHATRESTAPI_QT_EXPORT QDebug operator<<(QDebug d, const RocketChatRestApi::UserBaseJob::UserInfo &t);
