import os
import sys

current_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.normpath(os.path.join(current_path, '../')))
sys.path.append(os.path.normpath(os.path.join(current_path, '../../')))
sys.path.append(os.path.normpath(os.path.join(current_path, '../../../')))
sys.path.append(current_path)

from lib.openscenario.client.open_scenario_client import OpenScenarioClient

class OpenScenarioClientWrapper():   
    def __init__(self, ip, port):
        self.client = OpenScenarioClient(ip, port, self) 
        self.is_stopped = False
        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.is_stopped = False
        self.client.start_scenario()

    def stop_scenario(self):
        self.is_stopped = True
        self.client.stop_scenario()

    def start_scenario_callback(self, result, desc):
        if result is False:
            print('Failed to start scenario. Please see the log for details.')