#pragma once

#include <switchboard_openai/export.h>
#include <switchboard_core/Extension.hpp>

namespace switchboard::extensions::openai {

class SWITCHBOARDOPENAI_EXPORT OpenAINodeFactory;

class SWITCHBOARDOPENAI_EXPORT OpenAIExtension final : public Extension {
public:
    OpenAIExtension();
    ~OpenAIExtension() override;

    static void load();
    static OpenAIExtension* getInstance();

    std::string getApiKey() const;

    // MARK: Overridden methods

    std::string getName() override;
    std::shared_ptr<NodeFactory> getNodeFactory() override;
    Result<void> initialize(const SBAnyMap& config) override;

private:
    static std::shared_ptr<OpenAIExtension> sharedInstance;

    class Impl;
    std::unique_ptr<Impl> impl;
};

}
