/*
 * 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 EditWorldSizeCommand: public studio::UndoCommand {
	private:
		WorldStaticLoader &m_loader;
		WorldDoc &m_doc;
		ox::Size const m_oldSize;
		WorldDoc::TileMap m_oldMap;
		ox::Size const m_newSize;
	public:
		EditWorldSizeCommand(
				WorldStaticLoader &loader,
				WorldDoc &doc,
				ox::Size const &size);
		ox::Error redo() noexcept override;
		ox::Error undo() noexcept override;
		[[nodiscard]]
		int commandId() const noexcept override;
	private:
		enum class Dimension {
			X, Y, Both, Neither,
		};
		[[nodiscard]]
		Dimension dimensionChanged() const noexcept;
};

}
