#include <memory>

#include <QApplication>

#include "BalancingConfig.h"
#include "BalancingWindow.h"
#include "ConfigLoader.h"
#include "ConsoleLogger.h"
#include "logging.h"
#include "LogManager.h"

int main(int argc, char* argv[])
{
    LogManager::getInstance()->addLogger(std::make_shared<ConsoleLogger>());
    LogManager::getInstance()->setLoggingEnabled(true);
    LOG_INFO("Balancing tool starting");

    QApplication::setApplicationName("DotaFactory Balancing");

    if (QSysInfo::windowsVersion() != QSysInfo::WV_None)
    {
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
    }

    QApplication application(argc, argv);

    GameConfig gameConfig = ConfigLoader::loadFromDirectory(CONFIG_DIR);
    BalancingConfig balancingConfig = loadBalancingConfig(BALANCING_CONFIG);

    BalancingWindow window(balancingConfig, std::move(gameConfig), CONFIG_DIR, BALANCING_CONFIG);
    window.show();

    return application.exec();
}
