#include "index.hpp"
#ifndef LIGHT_CLIENT
#include "LocalUniverse.hpp"
#endif
#include "DistantUniverse.hpp"
#include "core/utils/logger.hpp"

#undef LOG_PREFIX
#define LOG_PREFIX "Client: "

namespace world::client {
    std::unique_ptr<Universe> Load(const Universe::login& login, const std::optional<Universe::connection>& ct, server_handle *const localHandle, const Universe::options &distOpts, const std::string& contouring) {
        if(ct.has_value()) {
            return std::make_unique<DistantUniverse>(login, ct.value(), distOpts, contouring);
#ifndef LIGHT_CLIENT
        } else if(localHandle != nullptr) {
            LOG_D("Using local universe");
            return std::make_unique<LocalUniverse>(login, localHandle, contouring);
#endif
        } else {
            FATAL("Must enable server.allow_local or define client.connection");
        }
    }
}