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

#include <QDebug>

#include "consts.hpp"
#include "newworldwizard.hpp"

namespace nostalgia::world {

using namespace studio;

const QString NewWorldWizard::FIELD_WORLD_PATH = "World.WorldPath";

NewWorldWizard::NewWorldWizard(const Context *ctx) {
	addLineEdit(tr("&Name:"), FIELD_WORLD_PATH, "", [this, ctx](QString worldName) {
			worldName = PATH_ZONES + worldName;
			auto exists = ctx->project->exists(worldName);
			if (exists) {
				this->showValidationError(tr("World already exists: %1").arg(worldName));
				return 1;
			}
			return 0;
		}
	);
}

}
