#pragma once

#include "../CommandHistory.h"
#include <pxr/usd/usd/stage.h>
#include <pxr/usd/sdf/path.h>
#include <string>

namespace UsdLayerManager {

/// Disconnects a shader input from its upstream source, capturing that
/// source at construction time so Undo can restore it.
class DisconnectShaderAttrCommand : public ICommand {
public:
    DisconnectShaderAttrCommand(pxr::UsdStageRefPtr stage,
                                const pxr::SdfPath&  destNode,
                                const std::string&   destInput);

    void Execute() override;
    void Undo()    override;
    std::string GetDescription() const override { return m_description; }

private:
    pxr::UsdStageRefPtr m_stage;
    pxr::SdfPath        m_destNode;
    std::string         m_destInput;
    std::string         m_description;

    bool         m_hadConnection = false;
    pxr::SdfPath m_sourceNode;
    std::string  m_sourceOutput;
};

} // namespace UsdLayerManager
