import logging


class DummyCamera:
    # class Imager:
    #     def get_image(self):
    #         pass
    #
    # data_stream = [Imager()]
    def __init__(self):
        self.log = logging.getLogger(f"{self.__class__.__name__} ({id(self)}) (dummy)")
        self.log.debug(f"__init__()")

    class BalanceRatioSelectorClass:
        def __init__(self, balance_selected, balance_values):
            self.balance_selected = balance_selected
            self.balance_values = balance_values
            self.log = logging.getLogger(f"{self.__class__.__name__} ({id(self)}) (dummy)")
            self.log.debug(f"__init__(balance_selected={balance_selected}, balance_values={balance_values})")

        def get(self):
            self.log.debug(f"{self.__class__.__name__}.get() -> {self.balance_selected}")
            return self.balance_selected

        def set(self, selector):
            self.balance_selected = selector
            self.log.debug(f"{self.__class__.__name__}.set({selector}) -> {self.balance_selected}")

    class BalanceRatioClass:
        def __init__(self, balance_selected, balance_values):
            self.balance_selected = balance_selected
            self.balance_values = balance_values
            self.log = logging.getLogger(f"{self.__class__.__name__} ({id(self)}) (dummy)")
            self.log.debug(f"__init__(balance_selected={balance_selected}, balance_values={balance_values})")

        def get(self):
            if self.balance_selected in self.balance_values:
                self.log.debug(f"{self.__class__.__name__}.get({self.balance_selected}) -> {self.balance_values[self.balance_selected]}")
                return self.balance_values[self.balance_selected]
            else:
                self.log.debug(f"{self.__class__.__name__}.get({self.balance_selected}) -> Not present -> None")
                return None

        def set(self, value):
            self.balance_values[self.balance_selected] = value
            self.log.debug(f"{self.__class__.__name__}.set({self.balance_selected}, {value}) -> {self.balance_values[self.balance_selected]}")

    balance_selected = None
    balance_values = {}

    BalanceRatioSelector = BalanceRatioSelectorClass(balance_selected, balance_values)
    BalanceRatio = BalanceRatioClass(balance_selected, balance_values)

    class GetSetReadable:
        value = None
        log = logging.getLogger(f"{__qualname__} ({id(__qualname__)}) (dummy)")

        @classmethod
        def get(cls):
            cls.log.debug(f"{cls.__name__}.get() -> {cls.value}")
            return cls.value

        @classmethod
        def set(cls, value):
            cls.value = value
            cls.log.debug(f"{cls.__name__}.set({value}) -> {cls.value}")

        @classmethod
        def is_readable(cls):
            cls.log.debug(f"{cls.__name__}.is_readable() -> {cls.value is not None}")
            return cls.value is not None

    class TriggerSoftware(GetSetReadable):
        @classmethod
        def send_command(cls, *args, **kwargs):
            cls.log.debug(f"{cls.__name__}.send_command(*{args}, **{kwargs})")

    class OffsetX(GetSetReadable):
        pass

    class OffsetY(GetSetReadable):
        pass

    class Width(GetSetReadable):
        pass

    class Height(GetSetReadable):
        pass

    class TriggerMode(GetSetReadable):
        pass

    class ExposureTime(GetSetReadable):
        pass

    class Gain(GetSetReadable):
        pass

    class GammaParam(GetSetReadable):
        pass

    class ContrastParam(GetSetReadable):
        pass

    class ColorCorrectionParam(GetSetReadable):
        pass

    class TriggerSource(GetSetReadable):
        pass

    def stream_on(self):
        self.log.debug(f"{self.__class__.__name__}.stream_on()")

    def stream_off(self):
        self.log.debug(f"{self.__class__.__name__}.stream_on()")
