/**
 * \file server.cpp
 * \brief Univerxel server
 * \author Shu
 * \version 0.0.2
 *
 * Univerxel standalone server program.
 */

#include "server/Server.hpp"
#include "core/options_part.hpp"
#include "core/utils/tracy.hpp"
#include "core/utils/logger.hpp"
#include "version.h"

/// Entry point
int main(int argc, char *argv[]){
    LOG("Univerxel server " << UNIVERXEL_VERSION);

#if TRACY_ENABLE
    LOG("Profiling !");
#endif

    auto options = config::options_part<config::server::options>(argc > 1 ? argv[1] : config::DEFAULT_FILE);
    options.save();

#if TRACY_ENABLE
    tracy::SetThreadName("Main");
#endif

    world::module::Registry::Load();

    auto server = Server(options.get());
    server.run();

    options.save();
    world::module::Registry::Unload();

    return 0;
}