from typing import (
    Optional,
    Any,
)

from messageprocessorutil import UuidMessageProcessor
from messagebus import (
    MessageBus,
    Message,
)

from production.interactor import DeviceStatusChangedInteractor


class DeviceStatusChangedProcessor(UuidMessageProcessor):

    def __init__(
        self,                       # type: DeviceStatusChangedProcessor
        device_status_interactor,   # type: DeviceStatusChangedInteractor
    ):
        # type: (...) -> None

        super(DeviceStatusChangedProcessor, self).__init__()

        self.devices_status_interactor = device_status_interactor

    def parse_data(
        self,           # type: DeviceStatusChangedProcessor
        data,           # type: Any
        event_type,     # type: str
    ):
        # type: (...) -> None

        return None

    def call_business(
        self,   # type: DeviceStatusChangedProcessor
        data,   # type: Any
    ):
        # type: (...) -> None

        return self.devices_status_interactor.execute()

    def format_response(
        self,           # type: DeviceStatusChangedProcessor
        message_bus,    # type: MessageBus
        message,        # type: Message
        event,          # type: Optional[Any]
        request,        # type: Any
        result,         # type: Any
    ):
        # type: (...) -> None

        return self._do_not_reply_to_asynchronous_event()

    def format_exception(
        self,           # type: DeviceStatusChangedProcessor
        message_bus,    # type: MessageBus
        message,        # type: Message
        event,          # type: Optional[Any]
        input_obj,      # type: Any
        exception,      # type: Exception
    ):
        # type: (...) -> None

        return self._do_not_reply_to_asynchronous_event()

    def format_parse_exception(
        self,           # type: DeviceStatusChangedProcessor
        message_bus,    # type: MessageBus
        message,        # type: Message
        event,          # type: Optional[Any]
        data,           # type: Any
        exception,      # type: Exception
    ):
        # type: (...) -> None

        return self._do_not_reply_to_asynchronous_event()

    @staticmethod
    def _do_not_reply_to_asynchronous_event():
        # type: (...) -> None

        return None
