from typing import Generic, TypeVar

TInput = TypeVar("TInput")  # pylint: disable=invalid-name
TOutput = TypeVar("TOutput")  # pylint: disable=invalid-name


class RouteHandler(Generic[TInput, TOutput]):
    """
    Base for API route handlers that expose services via HTTP.

    This abstract base class can be extended to create custom route handlers
    that integrate with the FastAPI application via dynamic registration.

    Example:
        class MyServiceRoute(RouteHandler[MyInput, MyOutput]):
            @property
            def route(self) -> str:
                return "/my_service"

            def handle(self, input_data: MyInput) -> MyOutput:
                # Process input and return output
                pass
    """

    @property
    def route(self) -> str:
        """Return the HTTP route path for this handler."""
        raise NotImplementedError

    def handle(self, input_data: TInput) -> TOutput:
        """Handle the request and return the response."""
        raise NotImplementedError
