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

#include "commands.hpp"

#include "addpagecommand.hpp"

namespace nostalgia::gfx {

AddPageCommand::AddPageCommand(Palette &pal) noexcept:
		m_pal(pal) {}

int AddPageCommand::commandId() const noexcept {
	return static_cast<int>(PaletteEditorCommandId::AddPage);
}

ox::Error AddPageCommand::redo() noexcept {
	m_pal.pages.emplace_back(ox::sfmt("Page {}", m_pal.pages.size() + 1), ox::Vector<PaletteColor>{});
	return {};
}

ox::Error AddPageCommand::undo() noexcept {
	m_pal.pages.pop_back();
	return {};
}

}
