#pragma once

#include "../CommandHistory.h"
#include "../LayerManager.h"
#include <string>

namespace UsdLayerManager {

class LayerCreateCommand : public ICommand {
public:
    LayerCreateCommand(LayerManager* mgr, std::string path, int index = -1);
    void Execute() override;
    void Undo()    override;
    std::string GetDescription() const override { return m_description; }

private:
    LayerManager* m_mgr;
    std::string   m_path;
    int           m_index;
    int           m_insertedIndex = -1;
    std::string   m_description;
};

class LayerRemoveCommand : public ICommand {
public:
    LayerRemoveCommand(LayerManager* mgr, int index);
    void Execute() override;
    void Undo()    override;
    std::string GetDescription() const override { return m_description; }

private:
    LayerManager* m_mgr;
    int           m_index;
    std::string   m_savedPath;
    std::string   m_description;
};

class LayerReorderCommand : public ICommand {
public:
    LayerReorderCommand(LayerManager* mgr, std::vector<std::string> before, std::vector<std::string> after);
    void Execute() override;
    void Undo()    override;
    std::string GetDescription() const override { return m_description; }

private:
    void ApplyOrder(const std::vector<std::string>& order);

    LayerManager*            m_mgr;
    std::vector<std::string> m_before;
    std::vector<std::string> m_after;
    std::string              m_description;
};

} // namespace UsdLayerManager
