from typing import Optional, Type, TypedDict, Any

from messageprocessor import MessageProcessor
from simplehttprouter import Route


class RouteBuildParams(TypedDict):
    route: Route
    processor_type: Optional[Type[MessageProcessor]]
    processor_instance: Optional[MessageProcessor]
    interactor_type: Optional[Type]
    interactor_instance: Optional[Any]
    interactor_method_name: Optional[str]
    request_type: Optional[Type]
    response_type: Optional[Type]
    success_status: Optional[int]
    request_content_type: Optional[str]
    response_content_type: Optional[str]


def build_params(
    route: Route,
    processor_type: Optional[Type[MessageProcessor]] = None,
    processor_instance: Optional[MessageProcessor] = None,
    interactor_type: Optional[Type] = None,
    interactor_instance: Optional[Any] = None,
    interactor_method_name: Optional[str] = None,
    request_type: Optional[Type] = None,
    response_type: Optional[Type] = None,
    success_status: Optional[int] = None,
    request_content_type: Optional[str] = None,
    response_content_type: Optional[str] = None,
) -> RouteBuildParams:
    return {
        "route": route,
        "processor_type": processor_type,
        "processor_instance": processor_instance,
        "interactor_type": interactor_type,
        "interactor_instance": interactor_instance,
        "interactor_method_name": interactor_method_name,
        "request_type": request_type,
        "response_type": response_type,
        "success_status": success_status,
        "request_content_type": request_content_type,
        "response_content_type": response_content_type,
    }
