from application_message_bus import ApplicationMessageBus
from ._MBMessage import MBMessage


class MbContextApplicationMessageBus(ApplicationMessageBus):
    def send_message(self, component, message):
        message.imp_message = MBMessage(
            token=message.token,
            format=message.data_type,
            data=message.data,
        )
        setattr(message.imp_message, "_message", message)

        return super().send_message(component, message)
