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

namespace world::client {
    std::unique_ptr<Universe> Load(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>(ct.value(), distOpts, contouring);
#ifndef STANDALONE
        } else if(localHandle != nullptr) {
            LOG_D("Using local universe");
            return std::make_unique<LocalUniverse>(localHandle, contouring);
#endif
        } else {
            FATAL("Must enable server.allow_local or define client.connection");
        }
    }
}