from abc import ABCMeta

from messagebus import (
    Event,
    Message,
    MessageBus,
)
from messageprocessorutil import UuidMessageProcessor
from typing import Any


class DefaultMessageProcessor(UuidMessageProcessor):
    __metaclass__ = ABCMeta

    def __init__(
        self,    # type: DefaultMessageProcessor
    ):
        # type: (...) -> None

        super(DefaultMessageProcessor, self).__init__()

    def parse_data(
        self,   # type: DefaultMessageProcessor
        data,   # type: str
        _,      # type: Any
    ):
        # type: (...) -> str

        return data or self._do_not_remove_this_function_bug_in_the_library()

    def format_parse_exception(
        self,           # type: DefaultMessageProcessor
        message_bus,    # type: MessageBus
        message,        # type: Message
        event,          # type: Event
        input_obj,      # type: Any
        exception,      # type: Any
    ):
        # type: (...) -> None

        self.format_exception(
            message_bus=message_bus,
            message=message,
            event=event,
            input_obj=input_obj,
            exception=exception,
        )

    @staticmethod
    def _do_not_remove_this_function_bug_in_the_library():
        return ''
