"""
A mockup implementation of the status database interface.
It does basically nothing and will be used if no database support is set up for the orchestrator.
"""
from typing import Optional, List, Tuple

from laborchestrator.database_integration import StatusDBInterface
from laborchestrator.structures import ProcessStep, ContainerInfo


class StatusDBDummyImplementation(StatusDBInterface):
    def position_empty(self, device: str, pos: int) -> bool:
        return True

    def get_available_processes(self) -> List[Tuple[str, str]]:
        return []

    def add_process_to_db(self, name: str, src: str) -> str:
        return ""

    def create_experiment(self, process_id: str) -> str:
        return "Hello World"

    def get_all_positions(self, device: str) -> List[int]:
        return [0]

    def get_container_at_position(self, device: str, pos: int) -> Optional[ContainerInfo]:
        return None

    def moved_container(self, source_device: str, source_pos: int, target_device: str, target_pos: int,
                        barcode: Optional[str] = None):
        pass

    def unlidded_container(self, cont_info: ContainerInfo, lid_device: str, lid_pos: int):
        pass

    def lidded_container(self, cont_info: ContainerInfo, lid_device: Optional[str] = None, lid_pos: Optional[int] = None):
        pass

    def get_cont_info_by_barcode(self, barcode: str) -> Optional[ContainerInfo]:
        return None

    def add_container(self, cont: ContainerInfo):
        pass

    def remove_container(self, cont: ContainerInfo):
        pass

    def set_barcode_at_position(self, barcode: str, device: str, pos: int):
        pass

    def set_barcode(self, cont: ContainerInfo):
        pass

    def update_lid_position(self, cont: ContainerInfo):
        pass

    def get_estimated_duration(self, step: ProcessStep, confidence=.95) -> Optional[float]:
        return None

    def get_estimated_durations(self, steps: List[ProcessStep], confidence=.95) -> List[Optional[float]]:
        return [None] * len(steps)

    def safe_step_to_db(self, step: ProcessStep, container_info: ContainerInfo, experiment_uuid: str):
        pass

    def write_server_certificate(self, device_name, cert: str) -> None:
        pass

    def get_server_certificate(self, device_name) -> str:
        return ""
