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

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

#pragma once
#include "textautogeneratetext_private_export.h"
#include <KConfigGroup>
#include <QUrl>
class QDebug;
namespace TextAutoGenerateText
{
class TEXTAUTOGENERATETEXT_TESTS_EXPORT TextAutoGenerateTextMcpServer
{
    Q_GADGET
public:
    enum class ServerType : int8_t {
        Unknown = 0,
        Sse,
        Stdio,
        // Http,
    };
    Q_ENUM(ServerType)

    TextAutoGenerateTextMcpServer();
    ~TextAutoGenerateTextMcpServer();

    void createUniqueIdentifier();

    [[nodiscard]] QUrl serverUrl() const;
    void setServerUrl(const QUrl &newServerUrl);

    [[nodiscard]] bool enabled() const;
    void setEnabled(bool newEnabled);

    [[nodiscard]] QString name() const;
    void setName(const QString &newName);

    [[nodiscard]] QByteArray identifier() const;
    void setIdentifier(const QByteArray &newIdentifier);

    void load(const KConfigGroup &config);
    void save(KConfigGroup &config);

    [[nodiscard]] bool isValid() const;

    [[nodiscard]] ServerType serverType() const;
    void setServerType(ServerType newServerType);

    [[nodiscard]] QString command() const;
    void setCommand(const QString &newCommand);

    [[nodiscard]] QStringList arguments() const;
    void setArguments(const QStringList &newArguments);

    [[nodiscard]] QMap<QString, QString> environments() const;
    void setEnvironments(const QMap<QString, QString> &newEnvironments);

private:
    bool mEnabled = true;
    QUrl mServerUrl;
    QString mName;
    QByteArray mIdentifier;
    ServerType mServerType = ServerType::Unknown;
    QString mCommand;
    QStringList mArguments;
    QMap<QString, QString> mEnvironments;
};
}
Q_DECLARE_TYPEINFO(TextAutoGenerateText::TextAutoGenerateTextMcpServer, Q_RELOCATABLE_TYPE);
TEXTAUTOGENERATETEXT_EXPORT QDebug operator<<(QDebug d, const TextAutoGenerateText::TextAutoGenerateTextMcpServer &t);
