import logging
from factum.config import settings
from factum.services.db_service import DBService
from factum.ui.main_window import FactumWindow
from PySide6.QtWidgets import QApplication

class FactumApp:
    def __init__(self, db_service: DBService):
        self.app = QApplication([])
        self.main_window = FactumWindow(db_service)
        
    def run(self):
        self.main_window.show()
        self.app.exec()
        logging.info("Factum application is running.")

def main():
    logging.basicConfig(level=settings.log_level)
    logging.debug(f"Starting Factum with level: {settings.log_level_str}")
    
    db_service = DBService()
    app = FactumApp(db_service)
    app.run()