# -*- coding: utf-8 -*-
"""
/***************************************************************************
 GeorefArApi
                                 A QGIS plugin
 Este plugin consume la API de Goeref-ar-api
 Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
                             -------------------
        begin                : 2026-03-27
        copyright            : (C) 2026 by Datos Argentina
        email                : datosargentina@sicyt.gob.ar
        git sha              : $Format:%H$
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
 This script initializes the plugin, making it known to QGIS.
"""
import os
import yaml


# noinspection PyPep8Naming
def classFactory(iface):  # pylint: disable=invalid-name
    """Load GeorefArApi class from file GeorefArApi.

    :param iface: A QGIS interface instance.
    :type iface: QgsInterface
    """
    dev_marker = os.path.join(os.path.dirname(__file__), '.dev')
    if os.path.exists(dev_marker):
        connect_debug()

    from .georef_qgis_plugin import GeorefQgisPlugin
    return GeorefQgisPlugin(iface)

def connect_debug():
    try:
        import pydevd_pycharm
        pydevd_pycharm.settrace(
            '127.0.0.1',
            port=5678,
            stdout_to_server=True,
            stderr_to_server=True,
            suspend=False
        )
        print("GEOREF-DEBUG: Conexión remota establecida desde classFactory.")
    except (ImportError, Exception) as e:
        print(f"GEOREF-DEBUG: Falló la conexión. Error: {e}")
