from typing import Type

from httpmessageprocessorutil.automapped import AutoMappedMessageProcessor

AnyType = Type["AnyType"]


class AutoMappedWebApi:
    def __init__(
        self,
        interactor_type: AnyType,
        request_type: Type = None,
        processor_type: Type[AutoMappedMessageProcessor] = None,
        success_status: int = 200,
        exception_map: dict = None,
        extra_mapping: dict = None,
        event_name: str = None,
        response_content_type: str = None,
    ):
        self.interactor_type = interactor_type
        self.request_type = request_type
        self.success_status = success_status
        self.exception_map = exception_map
        self.extra_mapping = extra_mapping
        self.event_name = event_name
        self.response_content_type = response_content_type
        self.processor_type = processor_type or AutoMappedMessageProcessor

    def __str__(self):
        values = [
            f"Processor: {self.processor_type}",
            f"Interactor: {self.interactor_type}",
            f"Request: {self.request_type}",
        ]
        return " - ".join(values)
