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

#pragma once

#include <ox/fs/fs.hpp>
#include <ox/std/memory.hpp>

#include "assetmanager.hpp"
#include "typeconv.hpp"

namespace keel {

class Context {
	public:
		ox::UPtr<ox::FileSystem> rom;
		ox::BasicString<32> appName{"Keel App"};
#ifndef OX_BARE_METAL
		AssetManager assetManager;
		ox::HashMap<ox::String, ox::UUID> pathToUuid;
		ox::HashMap<ox::UUIDStr, ox::String> uuidToPath;
		ox::Vector<Converter> converters;
		ox::Vector<PackTransform> packTransforms;
#else
		std::size_t preloadSectionOffset = 0;
#endif

		constexpr Context() noexcept = default;
		Context(Context const&) noexcept = delete;
		Context(Context&&) noexcept = delete;
		Context &operator=(Context const&) noexcept = delete;
		Context &operator=(Context&&) noexcept = delete;
		constexpr virtual ~Context() noexcept = default;
};

constexpr ox::SpanView<PackTransform> packTransforms(
		[[maybe_unused]] Context const &ctx) noexcept {
#ifndef OX_BARE_METAL
	return ctx.packTransforms;
#else
	return {};
#endif
}

constexpr ox::SpanView<Converter> converters(
		[[maybe_unused]] Context const &ctx) noexcept {
#ifndef OX_BARE_METAL
	return ctx.converters;
#else
	return {};
#endif
}

}
