from typing import Any

from ._DataSerializer import DataSerializer


class IdentityDataSerializer(DataSerializer):
    """Serializer that returns the result without transformation."""

    def serialize(self, result: Any) -> Any:
        return result

    def serialize_error(self, input_obj: Any, exception: Exception, original_payload: dict) -> dict:
        return {"error": type(exception).__name__, "message": str(exception)}

    def serialize_parser_error(self, data: bytes, exception: Exception) -> dict:
        return {"error": type(exception).__name__, "message": str(exception)}
