from logging import Logger

from httpmessageprocessor import HttpMessageProcessorMessageHandler
from httpmessageprocessorutil.automapped import AutoMappedMessageProcessor
from interactor.event import ElectronicPaymentEventInteractor
from interactor.route.cache_electronic_payment_interactor import \
    CacheElectronicPaymentInteractor
from interactor.route.cache_electronic_payment_interactor.dto import \
    CachePeripheralElectronicPaymentRequest
from interactor.route.customization_get_styles_interactor import CustomizationGetStylesInteractor
from interactor.route.customization_get_styles_interactor.dto import CustomizationGetStylesRequest
from interactor.route.menu_get_images_interactor import MenuGetImagesInteractor
from interactor.route.menu_get_images_interactor.dto._MenuGetImagesRequest import MenuGetImagesRequest
from interactor.route.menu_get_navigation_interactor \
    import MenuGetNavigationInteractor
from interactor.route.menu_get_navigation_interactor.dto import \
    MenuGetNavigationRequest
from interactor.route.menu_get_products_interactor import MenuGetProductsInteractor
from interactor.route.menu_get_products_interactor.dto import MenuGetProductsRequest
from interactor.route.menu_get_ruptured_products_interactor \
    import MenuGetRupturedProducts
from interactor.route.menu_get_ruptured_products_interactor.dto import \
    MenuGetRupturedProductsRequest
from interactor.route.menu_get_banners_interactor import MenuGetBannersInteractor
from interactor.route.menu_get_banners_interactor.dto import MenuGetBannersRequest
from interactor.route.order_add_items_interactor import OrderAddItemsInteractor
from interactor.route.order_add_items_interactor.dto import OrderAddItemsRequest
from interactor.route.order_add_properties_interactor \
    import OrderAddPropertiesInteractor
from interactor.route.order_add_properties_interactor.dto \
    import OrderAddPropertiesRequest
from interactor.route.order_apply_coupon_interactor import OrderApplyCouponInteractor
from interactor.route.order_apply_coupon_interactor.dto import OrderApplyCouponRequest
from interactor.route.order_cancel_interactor import OrderCancelInteractor
from interactor.route.order_cancel_interactor.dto import OrderCancelRequest
from interactor.route.order_change_items_quantity_interactor import OrderChangeItemsQuantityInteractor
from interactor.route.order_change_items_quantity_interactor.dto import OrderChangeItemsQuantityRequest
from interactor.route.order_close_shopping_cart_interactor import \
    OrderCloseShoppingCartInteractor
from interactor.route.order_close_shopping_cart_interactor.dto import \
    OrderCloseShoppingCartRequest
from interactor.route.order_create_interactor import OrderCreateInteractor
from interactor.route.order_create_interactor.dto import OrderCreateRequest
from interactor.route.order_delete_line_interactor import OrderDeleteLineInteractor
from interactor.route.order_delete_line_interactor.dto import OrderDeleteLineRequest
from interactor.route.order_finalize_interactor import OrderFinalizeInteractor
from interactor.route.order_finalize_interactor.dto import OrderFinalizeRequest
from interactor.route.order_get_detail_interactor import OrderGetDetailInteractor
from interactor.route.order_get_detail_interactor.dto import OrderGetDetailRequest
from interactor.route.order_insert_payment_interactor \
    import OrderInsertPaymentInteractor
from interactor.route.order_insert_payment_interactor.dto \
    import OrderInsertPaymentRequest
from interactor.route.order_reopen_shopping_cart_interactor import OrderReopenShoppingCartInteractor
from interactor.route.order_reopen_shopping_cart_interactor.dto import OrderReopenShoppingCartRequest
from interactor.route.order_remove_coupon_interactor import OrderRemoveCouponInteractor
from interactor.route.order_remove_coupon_interactor.dto import OrderRemoveCouponRequest
from interactor.route.payment_get_payment_types_interactor import PaymentGetPaymentTypesInteractor
from interactor.route.payment_get_payment_types_interactor.dto import PaymentGetPaymentTypesRequest
from interactor.route.electronic_payment_read_messages_interactor \
    import ElectronicPaymentReadMessagesInteractor
from interactor.route.electronic_payment_read_messages_interactor.dto \
    import PeripheralElectronicPaymentReadMessagesRequest
from interactor.route.electronic_payment_send_responses_interactor \
    import ElectronicPaymentSendResponsesInteractor
from interactor.route.electronic_payment_send_responses_interactor.dto \
    import PeripheralElectronicPaymentSendResponsesRequest
from interactor.route.customization_get_text_interactor import CustomizationGetTextInteractor
from interactor.route.customization_get_text_interactor.dto import CustomizationGetTextRequest
from interactor.route.peripheral_print_text import PeripheralPrintTextInteractor
from interactor.route.peripheral_print_text.dto import PeripheralPrintTextRequest
from interactor.route.peripheral_read_scanner import PeripheralReadScannerInteractor
from interactor.route.peripheral_read_scanner.dto import PeripheralReadScannerRequest
from interactor.route.status_get_store_interactor import StatusGetStoreInteractor
from interactor.route.status_get_store_interactor.dto import StatusGetStoreRequest
from interactor.route.customization_get_store_config_interactor import CustomizationGetStoreConfigInteractor
from interactor.route.customization_get_store_config_interactor.dto import CustomizationGetStoreConfigRequest
from interactor.route.order_cancel_payment_interactor import OrderCancelPaymentInteractor
from interactor.route.order_cancel_payment_interactor.dto import OrderCancelPaymentRequest
from mbcontextmessagehandler import MbContextMessageBus
from messagebus import Message, Event
from messagehandler import MessageHandlerBuilder, MessageHandler
from messageprocessor import MessageProcessor, DefaultMessageProcessorExecutorFactory, MessageProcessorMessageHandler
from messageprocessorutil import LoggingProcessorCallback
from model.config import Config
from model.event import ListenedEvents
from model.exception import ValidationError, \
    AuthValidationErrors, ExternalServiceErrors, OperationErrors
from model.response import Responses
from processor.event import \
    ElectronicPaymentCloseDialogProcessor, ElectronicPaymentShowBarcodeProcessor, \
    ElectronicPaymentShowChoicesProcessor, ElectronicPaymentShowInputProcessor, ElectronicPaymentShowMessageProcessor, \
    ElectronicPaymentShowQuestionProcessor
from pyscripts_cache import PyscriptsCache
from repository import PosRepository
from services import (
    FiscalService,
    OrderService,
    ApiService,
    CouponService,
    ImagesService,
    PaymentService
)
from simplehttprouter import Route
from typing import Dict, Optional


class ServiceMessageHandlerBuilder(MessageHandlerBuilder):

    def __init__(self, logger, config, message_bus, flask_server=False):
        # type: (Logger, Config, MbContextMessageBus, bool) -> None

        self.logger = logger
        self.config = config
        self.message_bus = message_bus
        self.flask_server = flask_server

        self.pos_repository = None
        self.fiscal_service = None
        self.coupon_service = None
        self.order_service = None
        self.api_service = None
        self.modifier_service = None
        self.images_service = None
        self.payment_service = None

        self.pyscripts_cache = None

        self.cache_menu_ruptured_items = {"last_request_date": None, "data": None}
        self.cache_menu_products = None
        self.cache_menu_navigation = []
        self.electronic_messages = []

        self.callbacks = None
        self.message_handler = None

    def build_singletons(self):
        # type: () -> None

        self.callbacks = [LoggingProcessorCallback(self.logger)]

        if self.flask_server:
            self.pos_repository = PosRepository(self.message_bus, self.logger, self.config)
            self.fiscal_service = FiscalService(self.message_bus, self.logger)
            self.coupon_service = CouponService(self.message_bus, self.logger)
            self.pyscripts_cache = PyscriptsCache(self.message_bus.mbcontext)
            self.order_service = OrderService()
            self.images_service = ImagesService()
            self.payment_service = PaymentService(self.message_bus)

            self.fiscal_service.get_electronic_payments_id()
        else:
            self.api_service = ApiService(self.config, self.logger)

            events_processors = self._build_events_processors()
            default_message_processor_executor_factory = DefaultMessageProcessorExecutorFactory(self.callbacks)
            self.message_handler = MessageProcessorMessageHandler(events_processors,
                                                                  None,
                                                                  default_message_processor_executor_factory)

    def build_message_handler(self, message=None, event=None):
        # type: (Optional[Message], Optional[Event]) -> MessageHandler

        if self.flask_server:
            processors_routes = self._build_processors_routes()
            http_message_processor = HttpMessageProcessorMessageHandler(route_processor=processors_routes,
                                                                        callbacks=self.callbacks)
            return http_message_processor
        else:
            return self.message_handler

    def destroy_message_handler(self, message_handler):
        # type: (MessageHandler) -> None

        pass

    def destroy_singletons(self):
        # type: () -> None

        pass

    def _build_events_processors(self):
        # type: () -> Optional[Dict[str, MessageProcessor]]

        electronic_payment_event_interactor = ElectronicPaymentEventInteractor(self.api_service)

        electronic_payment_close_dialog_processor = \
            ElectronicPaymentCloseDialogProcessor(electronic_payment_event_interactor)
        electronic_payment_show_barcode_processor = \
            ElectronicPaymentShowBarcodeProcessor(electronic_payment_event_interactor)
        electronic_payment_show_choices_processor = \
            ElectronicPaymentShowChoicesProcessor(electronic_payment_event_interactor)
        electronic_payment_show_input_processor = \
            ElectronicPaymentShowInputProcessor(electronic_payment_event_interactor)
        electronic_payment_show_message_processor = \
            ElectronicPaymentShowMessageProcessor(electronic_payment_event_interactor)
        electronic_payment_show_question_processor = \
            ElectronicPaymentShowQuestionProcessor(electronic_payment_event_interactor)

        events_processors = {
            ListenedEvents.ELECTRONIC_PAYMENT_CLOSE_DIALOGS: electronic_payment_close_dialog_processor,
            ListenedEvents.ELECTRONIC_PAYMENT_SHOW_BARCODE: electronic_payment_show_barcode_processor,
            ListenedEvents.ELECTRONIC_PAYMENT_SHOW_CHOICES: electronic_payment_show_choices_processor,
            ListenedEvents.ELECTRONIC_PAYMENT_SHOW_INPUT: electronic_payment_show_input_processor,
            ListenedEvents.ELECTRONIC_PAYMENT_SHOW_MESSAGE: electronic_payment_show_message_processor,
            ListenedEvents.ELECTRONIC_PAYMENT_SHOW_QUESTION: electronic_payment_show_question_processor
        }

        return events_processors

    def _build_processors_routes(self):
        # type: () -> Dict[Route, MessageProcessor]

        customization_get_styles_interactor = CustomizationGetStylesInteractor(
                logger=self.logger,
                config=self.config
        )
        order_add_items_interactor = \
            OrderAddItemsInteractor(self.logger, self.config, self.pos_repository)
        order_cancel_interactor = \
            OrderCancelInteractor(self.logger, self.config, self.pos_repository)
        order_delete_line_interactor = \
            OrderDeleteLineInteractor(self.logger, self.config, self.pos_repository)
        order_close_shopping_cart_interactor = \
            OrderCloseShoppingCartInteractor(self.logger, self.config, self.pos_repository, self.order_service)
        order_create_interactor = \
            OrderCreateInteractor(self.logger, self.config, self.pos_repository)
        order_add_properties_interactor = \
            OrderAddPropertiesInteractor(self.logger, self.config, self.pos_repository)
        order_finalize_interactor = \
            OrderFinalizeInteractor(self.logger, self.config, self.pos_repository, self.fiscal_service)
        order_get_detail_interactor = \
            OrderGetDetailInteractor(self.logger, self.config, self.pos_repository, self.order_service)
        order_insert_payment_interactor = \
            OrderInsertPaymentInteractor(self.logger, self.config, self.pos_repository, self.fiscal_service)
        order_change_items_quantity_interactor = \
            OrderChangeItemsQuantityInteractor(self.logger, self.config, self.pos_repository)
        order_reopen_shopping_cart_interactor = OrderReopenShoppingCartInteractor(
            logger=self.logger,
            config=self.config,
            pos_repository=self.pos_repository,
            order_service=self.order_service
        )
        order_apply_coupon_interactor = OrderApplyCouponInteractor(
            logger=self.logger,
            config=self.config,
            pos_repository=self.pos_repository,
            coupon_service=self.coupon_service,
            order_service=self.order_service
        )
        order_remove_coupon_interactor = OrderRemoveCouponInteractor(
            logger=self.logger,
            config=self.config,
            pos_repository=self.pos_repository,
            order_service=self.order_service
        )
        menu_get_products_interactor = \
            MenuGetProductsInteractor(self.logger, self.config, self.pos_repository, self.cache_menu_products)
        menu_get_ruptured_products = \
            MenuGetRupturedProducts(self.logger, self.config, self.pos_repository, self.cache_menu_ruptured_items)
        menu_get_navigation_interactor = MenuGetNavigationInteractor(
            logger=self.logger,
            config=self.config,
            pos_repository=self.pos_repository,
            cache_navigation=self.cache_menu_navigation
        )
        menu_get_images_interactor = MenuGetImagesInteractor(self.logger, self.config, self.images_service)
        menu_get_banners_interactor = MenuGetBannersInteractor(
            logger=self.logger,
            config=self.config
        )
        payment_get_payment_types_interactor = PaymentGetPaymentTypesInteractor(
            self.logger,
            self.config,
            self.pos_repository,
            self.payment_service
        )
        peripheral_electronic_payment_read_messages_interactor = \
            ElectronicPaymentReadMessagesInteractor(self.logger,
                                                    self.config,
                                                    self.pos_repository,
                                                    self.fiscal_service,
                                                    self.electronic_messages)
        peripheral_electronic_payment_send_responses_interactor = \
            ElectronicPaymentSendResponsesInteractor(self.logger,
                                                     self.config,
                                                     self.pos_repository,
                                                     self.fiscal_service,
                                                     self.electronic_messages)
        peripheral_print_text_interactor = \
            PeripheralPrintTextInteractor(self.logger, self.config, self.pos_repository)
        peripheral_read_scanner_interactor = \
            PeripheralReadScannerInteractor(self.logger, self.config, self.pos_repository)
        status_get_store_interactor = \
            StatusGetStoreInteractor(self.logger, self.config, self.pos_repository)
        cache_peripheral_electronic_payment_interactor = \
            CacheElectronicPaymentInteractor(self.logger, self.config, self.electronic_messages)

        customization_get_store_config_interactor = CustomizationGetStoreConfigInteractor(
            logger=self.logger,
            config=self.config,
            pos_repository=self.pos_repository
        )

        customization_get_text_interactor = CustomizationGetTextInteractor(
            self.logger,
            self.config,
            self.pos_repository
        )

        order_cancel_payment_interactor = OrderCancelPaymentInteractor(
            self.logger,
            self.config,
            self.pos_repository
        )

        processor_routes = {
            Route("GET", "/order/getDetail/{posId}"): AutoMappedMessageProcessor(
                    OrderGetDetailRequest,
                    order_get_detail_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }),

            Route("POST", "/order/create/{posId}"): AutoMappedMessageProcessor(
                    OrderCreateRequest,
                    order_create_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    },
                    success_status=201),

            Route("POST", "/order/addProperties/{posId}"): AutoMappedMessageProcessor(
                    OrderAddPropertiesRequest,
                    order_add_properties_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    },
                    success_status=204),

            Route("POST", "/order/addItems/{posId}"): AutoMappedMessageProcessor(
                    OrderAddItemsRequest,
                    order_add_items_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    },
                    success_status=204),

            Route("POST", "/order/changeItemsQuantity/{posId}"): AutoMappedMessageProcessor(
                    OrderChangeItemsQuantityRequest,
                    order_change_items_quantity_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    },
                    success_status=204),

            Route("POST", "/order/insertPayment/{posId}"): AutoMappedMessageProcessor(
                    OrderInsertPaymentRequest,
                    order_insert_payment_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }),

            Route("DELETE", "/order/cancelPayment/{posId}/{tenderId}"): AutoMappedMessageProcessor(
                    OrderCancelPaymentRequest,
                    order_cancel_payment_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }),

            Route("POST", "/order/cancel/{posId}"): AutoMappedMessageProcessor(
                    OrderCancelRequest,
                    order_cancel_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    },
                    success_status=204),

            Route("DELETE", "/order/deleteLine/{posId}"): AutoMappedMessageProcessor(
                    OrderDeleteLineRequest,
                    order_delete_line_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    },
                    success_status=204),

            Route("POST", "/order/closeShoppingCart/{posId}"): AutoMappedMessageProcessor(
                    OrderCloseShoppingCartRequest,
                    order_close_shopping_cart_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }),

            Route("POST", "/order/reopenShoppingCart/{posId}"): AutoMappedMessageProcessor(
                    request_type=OrderReopenShoppingCartRequest,
                    interactor=order_reopen_shopping_cart_interactor,
                    exception_map={
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }
            ),

            Route("POST", "/order/finalize/{posId}"): AutoMappedMessageProcessor(
                    OrderFinalizeRequest,
                    order_finalize_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    },
                    success_status=204),

            Route("POST", "/order/applyCoupon/{posId}"): AutoMappedMessageProcessor(
                    OrderApplyCouponRequest,
                    order_apply_coupon_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    },
                    success_status=200),

            Route("DELETE", "/order/removeCoupon/{posId}"): AutoMappedMessageProcessor(
                    OrderRemoveCouponRequest,
                    order_remove_coupon_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }),

            Route("GET", "/menu/products"): AutoMappedMessageProcessor(
                    MenuGetProductsRequest,
                    menu_get_products_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    },
                    response_content_type="application/gzip"),

            Route("GET", "/menu/rupturedProducts"): AutoMappedMessageProcessor(
                    MenuGetRupturedProductsRequest,
                    menu_get_ruptured_products,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }),

            Route("GET", "/menu/navigation/{posId}"): AutoMappedMessageProcessor(
                    MenuGetNavigationRequest,
                    menu_get_navigation_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }),

            Route("GET", "/menu/images"): AutoMappedMessageProcessor(
                    MenuGetImagesRequest,
                    menu_get_images_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }),

            Route("GET", "/menu/banners"): AutoMappedMessageProcessor(
                    MenuGetBannersRequest,
                    menu_get_banners_interactor,
                    {
                        AuthValidationErrors: Responses.AuthValidation
                    }),

            Route("GET", "/payment/paymentTypes"): AutoMappedMessageProcessor(
                    PaymentGetPaymentTypesRequest,
                    payment_get_payment_types_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }),

            Route("POST", "/peripheral/electronicPayment/readMessages/{posId}"): AutoMappedMessageProcessor(
                    PeripheralElectronicPaymentReadMessagesRequest,
                    peripheral_electronic_payment_read_messages_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }),

            Route("POST", "/peripheral/electronicPayment/sendResponse/{posId}"): AutoMappedMessageProcessor(
                    PeripheralElectronicPaymentSendResponsesRequest,
                    peripheral_electronic_payment_send_responses_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    },
                    success_status=204),

            Route("POST", "/peripheral/printText/{posId}"): AutoMappedMessageProcessor(
                    PeripheralPrintTextRequest,
                    peripheral_print_text_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError
                    },
                    success_status=204),

            Route("GET", "/peripheral/readScanner/{posId}"): AutoMappedMessageProcessor(
                    PeripheralReadScannerRequest,
                    peripheral_read_scanner_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    },
                    success_status=200),

            Route("GET", "/status/store/{posId}"): AutoMappedMessageProcessor(
                    StatusGetStoreRequest,
                    status_get_store_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }),

            Route("POST", "/cache/peripheral/electronicPayment"): AutoMappedMessageProcessor(
                    CachePeripheralElectronicPaymentRequest,
                    cache_peripheral_electronic_payment_interactor,
                    {},
                    success_status=204),

            Route("GET", "/customization/getStyles"): AutoMappedMessageProcessor(
                    request_type=CustomizationGetStylesRequest,
                    interactor=customization_get_styles_interactor,
                    exception_map={
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    }
            ),

            Route("GET", "/customization/getText"): AutoMappedMessageProcessor(
                    CustomizationGetTextRequest,
                    customization_get_text_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError
                    }),

            Route("GET", "/customization/storeConfig/{posId}"): AutoMappedMessageProcessor(
                    CustomizationGetStoreConfigRequest,
                    customization_get_store_config_interactor,
                    {
                        ValidationError: Responses.ValidationError,
                        AuthValidationErrors: Responses.AuthValidation,
                        ExternalServiceErrors: Responses.ExternalServicesError,
                        OperationErrors: Responses.OperationErrors
                    })
        }

        return processor_routes
