#include "NetworkManager.h"

NetworkManager::NetworkManager()
{
    mHttpClient = std::make_unique<HttpClient>();
}

NetworkManager::~NetworkManager()
{

}

std::unique_ptr<NetworkManager> NetworkManager::Create()
{
    return std::make_unique<NetworkManager>();
}

void NetworkManager::runHttpServer(AbstractWebApp* webApp)
{
    if (!mHttpServer)
    {
        mHttpServer = std::make_unique<HttpServer>();
    }

    HttpServer::Address address;
    address.mHost = "127.0.0.1";
    address.mPort = 8000;

    mHttpServer->run(webApp, address);
}

HttpClient* NetworkManager::getHttpClient() const
{
    return mHttpClient.get();
}