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

from typing import Optional
from uuid import UUID, uuid4

from sila2.server import SilaServer

from .feature_implementations.labware_impl import LabwareImpl
from .feature_implementations.sessionmanagement_impl import SessionManagementImpl
from .generated.labware import LabwareFeature
from .generated.sessionmanagement import SessionManagementFeature

from .base import Base


class Server(SilaServer):
    def __init__(
        self,
        server_uuid: Optional[UUID] = None,
        name: Optional[str] = None,
        description: Optional[str] = None,
    ):
        if name is None:
            name = "Opentrons 2 or Opentrons Flex"
        if description is None:
            description = "Server for the Opentrons 2 or Opentrons Flex"
        super().__init__(
            server_name=name,
            server_description=description,
            server_type="Pipetting",
            server_version="0.2.0_beta",
            server_vendor_url="https://gitlab.com/SiLA2/sila_python",
            server_uuid=server_uuid if server_uuid is not None else uuid4(),
        )

        self.base = Base()

        self.sessionmanagement = SessionManagementImpl(self, self.base, simulate=False)
        self.set_feature_implementation(SessionManagementFeature, self.sessionmanagement)

        self.labware = LabwareImpl(self, self.base)
        self.set_feature_implementation(LabwareFeature, self.labware)
