// SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause

#include <QQmlContext>
#include <QtQuick>
#include <QDebug>

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    QQmlEngine engine;
    engine.addImportPath("application/lib/qmlplugins");
    QQmlContext *context = new QQmlContext(engine.rootContext());
    QQmlComponent component(&engine, QString("application/qml/MapComponent.qml"));
    // https://doc.qt.io/qt-5/qqmlcomponent.html#isError
    if (component.isError()) {
        for (size_t i = 0; i < component.errors().size(); i++) {
            qDebug() << component.errors().at(i);
        }
        return 1;
    }
    QObject *window = component.create(context);
    // https://doc.qt.io/qt-5/qqmlcomponent.html#create
    // https://doc.qt.io/qt-5/qqmlcomponent.html#isReady
    return component.isReady() && window == nullptr;
}