import sys
from PyQt6.QtWidgets import QApplication
from core.config import Config
from ui.main_window import MainWindow
from ui.setup_dialog import SetupDialog

def main():
    app = QApplication(sys.argv)
    app.setApplicationName("my-publisher")
    app.setOrganizationName("danix")

    config = Config.load()
    if not config.is_complete():
        dlg = SetupDialog(config)
        if dlg.exec() == 0:
            sys.exit(0)
        config = Config.load()

    window = MainWindow(config)
    window.show()
    sys.exit(app.exec())

if __name__ == "__main__":
    main()
