//
//  SwitchboardObjectResolver.hpp
//  SwitchboardSDK
//

#pragma once

#include <string>
#include <switchboard/export.h>

namespace switchboard {

class SwitchboardObject;
class SwitchboardObjectStore;

/**
 * @brief Resolves Switchboard objects by their id.
 *
 * @details Part of the extension-facing API. Lets extension code obtain a pointer to
 *          another object managed by the SDK (for example, a sibling node that an audio
 *          player should synchronize with) without depending on internal SDK headers.
 */
class SWITCHBOARDSDK_EXPORT SwitchboardObjectResolver {
public:
    /**
     * @brief Returns the shared resolver instance.
     */
    static SwitchboardObjectResolver& getInstance();

    SwitchboardObjectResolver(const SwitchboardObjectResolver&) = delete;
    SwitchboardObjectResolver& operator=(const SwitchboardObjectResolver&) = delete;

    /**
     * @brief Resolves an object by its id (or URI).
     *
     * @param objectID The id (or URI) of the object to resolve.
     *
     * @return The object if found, nullptr otherwise.
     */
    SwitchboardObject* getObject(const std::string& objectID);

private:
    SwitchboardObjectResolver();

    SwitchboardObjectStore* objectStore;
};

}
