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

#pragma once

#include <studio/studio.hpp>

#include <nostalgia/gfx/palette.hpp>

namespace nostalgia::gfx {

class MoveColorCommand: public studio::UndoCommand {
	private:
		Palette &m_pal;
		std::size_t const m_srcIdx = 0;
		std::size_t const m_dstIdx = 0;

	public:
		MoveColorCommand(Palette &pal, size_t srcIdx, size_t dstIdx) noexcept;

		~MoveColorCommand() noexcept override = default;

		[[nodiscard]]
		int commandId() const noexcept override;

		ox::Error redo() noexcept override;

		ox::Error undo() noexcept override;

	private:
		void moveColor(size_t srcIdx, size_t dstIdx) noexcept;
};

}
