# Generated by sila2.code_generator; sila2.__version__: 0.10.3

from typing import Optional
from uuid import UUID

from sila2.server import SilaServer

from .feature_implementations.cancelcontroller_impl import CancelControllerImpl
from .feature_implementations.laborchestratorservice_impl import LabOrchestratorServiceImpl
from .feature_implementations.pausecontroller_impl import PauseControllerImpl
from .feature_implementations.simulationcontroller_impl import SimulationControllerImpl
from .generated.cancelcontroller import CancelControllerFeature
from .generated.laborchestratorservice import LabOrchestratorServiceFeature
from .generated.pausecontroller import PauseControllerFeature
from .generated.simulationcontroller import SimulationControllerFeature
from laborchestrator.orchestrator_interface import OrchestratorInterface


class Server(SilaServer):
    def __init__(self, orchestrator: OrchestratorInterface, server_uuid: Optional[UUID] = None):
        super().__init__(
            server_name="Orchestrator",
            server_type="PythonLabOrchestratorServer",
            server_version="0.1",
            server_description="Use this to control a running pythonlaborchestrator",
            server_vendor_url="https://gitlab.com/SiLA2/sila_python",
            server_uuid=server_uuid,
        )
        self.orchestrator = orchestrator

        self.cancelcontroller = CancelControllerImpl(self)
        self.set_feature_implementation(CancelControllerFeature, self.cancelcontroller)

        self.laborchestratorservice = LabOrchestratorServiceImpl(self)
        self.set_feature_implementation(LabOrchestratorServiceFeature, self.laborchestratorservice)

        self.pausecontroller = PauseControllerImpl(self)
        self.set_feature_implementation(PauseControllerFeature, self.pausecontroller)

        self.simulationcontroller = SimulationControllerImpl(self)
        self.set_feature_implementation(SimulationControllerFeature, self.simulationcontroller)
