/*
 * Copyright 2023 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
 */

#pragma once

#include <studio/undostack.hpp>

#include <jasper/world/world.hpp>

namespace jasper::world {

class ModifyTilesCommand: public studio::UndoCommand {
	public:
		struct Mod {
			uint8_t layer{};
			ox::Point tileAddr;
			ObjectId objId{};
			uint64_t setId{};
		};
	private:
		WorldStaticLoader &m_loader;
		WorldDoc &m_doc;
		ox::Vector<Mod> m_mods;
	public:
		ModifyTilesCommand(
				WorldStaticLoader &loader,
				WorldDoc &doc,
				ox::Vector<Mod> mods);
		ox::Error redo() noexcept override;
		ox::Error undo() noexcept override;
		[[nodiscard]]
		int commandId() const noexcept override;
	private:
		ox::Error swap() noexcept;
};

}
