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

#include <ox/std/memory.hpp>

#include <studio/studio.hpp>

#include "paletteeditor/paletteeditor-imgui.hpp"
#include "tilesheeteditor/tilesheeteditor-imgui.hpp"
#include "subcommands/export-tilesheet/export-tilesheet.hpp"

namespace nostalgia::gfx {

static struct: studio::Module {

	ox::String id() const noexcept final {
		return ox::String{"net.drinkingtea.nostalgia.gfx"};
	}

	ox::Vector<studio::Command> commands() const final {
		return {
			{
				"export-tilesheet",
				cmdExportTilesheet,
			}
		};
	}

	ox::Vector<studio::EditorMaker> editors(studio::Context &ctx) const noexcept final {
		return {
			studio::editorMaker<TileSheetEditorImGui>(ctx, {FileExt_ng, FileExt_nts}),
			studio::editorMaker<PaletteEditorImGui>(ctx, FileExt_npal),
		};
	}

	ox::Vector<ox::UPtr<studio::ItemMaker>> itemMakers(studio::Context&) const noexcept final {
		ox::Vector<ox::UPtr<studio::ItemMaker>> out;
		out.emplace_back(ox::make<studio::ItemMakerT<TileSheet>>("Tile Sheet", "TileSheets", FileExt_nts));
		out.emplace_back(ox::make<studio::ItemMakerT<Palette>>("Palette", "Palettes", FileExt_npal, Palette{
			.colorNames = {},
			.pages = {{"Page 1", ox::Vector<PaletteColor>{}}},
		}, ox::ClawFormat::Organic));
		return out;
	}

} const mod;

studio::Module const *studioModule() noexcept {
	return &mod;
}

}
