//
//  Extension.hpp
//  SwitchboardSDK
//
//  Created by Balazs Kiss on 30/08/2024.
//

#pragma once

#include <switchboard/export.h>
#include <switchboard_core/NodeFactory.hpp>
#include <switchboard_core/SwitchboardObject.hpp>

#include <string>

namespace switchboard {

/**
 * @brief Interface for Switchboard SDK extensions.
 */
class SWITCHBOARDSDK_EXPORT Extension : public SwitchboardObject {
public:

    /**
     * @brief Constructor for the Extension class.
     * @details The constructor initializes the SwitchboardObject with the type EXTENSION.
     */
    Extension() : SwitchboardObject(SwitchboardObjectType::EXTENSION) {}

    /**
     * @brief Destructor.
     */
    virtual ~Extension() = default;

    /**
     * @brief Initializes the extension.
     *
     * @param config Configuration values for the extension.
     *
     * @return A successful result if the extension was initialized successfully, an error result otherwise.
     */
    virtual Result<void> initialize(const SBAnyMap& config) {
        return makeSuccess();
    }

    /**
     * @brief Deinitializes the extension.
     *
     * @return A successful result if the extension was deinitialized successfully, an error result otherwise.
     */
    virtual Result<void> deinitialize() {
        return makeSuccess();
    }

    /**
     * @brief Gets the name of the extension.
     *
     * @return std::string The name of the extension.
     */
    virtual std::string getName() = 0;

    /**
     * @brief Gets a human-readable description of the extension.
     *
     * @return std::string The description of the extension.
     */
    virtual std::string getDescription() = 0;

    /**
     * @brief Gets the NodeFactory object of the extension.
     * @details The NodeFactory object is used to create custom nodes.
     *
     * @return std::shared_ptr<NodeFactory> The NodeFactory object of the extension.
     */
    virtual std::shared_ptr<NodeFactory> getNodeFactory() = 0;
};

}
