import os
import sys
import threading

from PyQt5 import QtCore, QtWidgets, QtGui, uic
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIntValidator
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject

from lib.openscenario.client.open_scenario_client import OpenScenarioClient

class OpenScenarioClientWrapper(QObject):   
    def __init__(self, ip, port):
        super().__init__()

        self.client = OpenScenarioClient(ip, port, self) 
        self.open_scenario_importer = None

    def set_open_scenario_importer(self, open_scenario_importer):
        """ open_scenario_importer instance 설정 """
        self.client.set_open_scenario_importer(open_scenario_importer)
        
    def start_scenario(self):
        self.client.start_scenario()

    def stop_scenario(self):
        self.client.stop_scenario()

    def get_stop_status(self):
        return self.client.is_start

    @pyqtSlot(bool, str)
    def start_scenario_callback(self, result, desc):
        """scenario runner에서 사용 시 callback 함수를 등록해줘야 하기 때문에 에러나지 않게 하기 위해 정의"""
        pass

    @pyqtSlot(bool, str) 
    def stop_scenario_callback(self, result, desc):
        """scenario runner에서 사용 시 callback 함수를 등록해줘야 하기 때문에 에러나지 않게 하기 위해 정의"""
        pass