# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""

import grpc
import warnings

from . import a2a_pb2 as a2a__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2

GRPC_GENERATED_VERSION = "1.76.0"
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower

    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f"The grpc package installed is at version {GRPC_VERSION},"
        + " but the generated code in a2a_pb2_grpc.py depends on"
        + f" grpcio>={GRPC_GENERATED_VERSION}."
        + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}"
        + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}."
    )


class A2AServiceStub(object):
    """A2AService defines the operations of the A2A protocol."""

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.SendMessage = channel.unary_unary(
            "/a2a.v1.A2AService/SendMessage",
            request_serializer=a2a__pb2.SendMessageRequest.SerializeToString,
            response_deserializer=a2a__pb2.SendMessageResponse.FromString,
            _registered_method=True,
        )
        self.SendStreamingMessage = channel.unary_stream(
            "/a2a.v1.A2AService/SendStreamingMessage",
            request_serializer=a2a__pb2.SendMessageRequest.SerializeToString,
            response_deserializer=a2a__pb2.StreamResponse.FromString,
            _registered_method=True,
        )
        self.GetTask = channel.unary_unary(
            "/a2a.v1.A2AService/GetTask",
            request_serializer=a2a__pb2.GetTaskRequest.SerializeToString,
            response_deserializer=a2a__pb2.Task.FromString,
            _registered_method=True,
        )
        self.ListTasks = channel.unary_unary(
            "/a2a.v1.A2AService/ListTasks",
            request_serializer=a2a__pb2.ListTasksRequest.SerializeToString,
            response_deserializer=a2a__pb2.ListTasksResponse.FromString,
            _registered_method=True,
        )
        self.CancelTask = channel.unary_unary(
            "/a2a.v1.A2AService/CancelTask",
            request_serializer=a2a__pb2.CancelTaskRequest.SerializeToString,
            response_deserializer=a2a__pb2.Task.FromString,
            _registered_method=True,
        )
        self.SubscribeToTask = channel.unary_stream(
            "/a2a.v1.A2AService/SubscribeToTask",
            request_serializer=a2a__pb2.SubscribeToTaskRequest.SerializeToString,
            response_deserializer=a2a__pb2.StreamResponse.FromString,
            _registered_method=True,
        )
        self.SetTaskPushNotificationConfig = channel.unary_unary(
            "/a2a.v1.A2AService/SetTaskPushNotificationConfig",
            request_serializer=a2a__pb2.SetTaskPushNotificationConfigRequest.SerializeToString,
            response_deserializer=a2a__pb2.TaskPushNotificationConfig.FromString,
            _registered_method=True,
        )
        self.GetTaskPushNotificationConfig = channel.unary_unary(
            "/a2a.v1.A2AService/GetTaskPushNotificationConfig",
            request_serializer=a2a__pb2.GetTaskPushNotificationConfigRequest.SerializeToString,
            response_deserializer=a2a__pb2.TaskPushNotificationConfig.FromString,
            _registered_method=True,
        )
        self.ListTaskPushNotificationConfig = channel.unary_unary(
            "/a2a.v1.A2AService/ListTaskPushNotificationConfig",
            request_serializer=a2a__pb2.ListTaskPushNotificationConfigRequest.SerializeToString,
            response_deserializer=a2a__pb2.ListTaskPushNotificationConfigResponse.FromString,
            _registered_method=True,
        )
        self.GetExtendedAgentCard = channel.unary_unary(
            "/a2a.v1.A2AService/GetExtendedAgentCard",
            request_serializer=a2a__pb2.GetExtendedAgentCardRequest.SerializeToString,
            response_deserializer=a2a__pb2.AgentCard.FromString,
            _registered_method=True,
        )
        self.DeleteTaskPushNotificationConfig = channel.unary_unary(
            "/a2a.v1.A2AService/DeleteTaskPushNotificationConfig",
            request_serializer=a2a__pb2.DeleteTaskPushNotificationConfigRequest.SerializeToString,
            response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            _registered_method=True,
        )


class A2AServiceServicer(object):
    """A2AService defines the operations of the A2A protocol."""

    def SendMessage(self, request, context):
        """Send a message to the agent."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def SendStreamingMessage(self, request, context):
        """SendStreamingMessage is a streaming version of SendMessage."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def GetTask(self, request, context):
        """Get the current state of a task from the agent."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def ListTasks(self, request, context):
        """List tasks with optional filtering and pagination."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def CancelTask(self, request, context):
        """Cancel a task."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def SubscribeToTask(self, request, context):
        """SubscribeToTask allows subscribing to task updates for tasks not in terminal state.
        Returns UnsupportedOperationError if task is in terminal state (completed, failed, cancelled, rejected).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def SetTaskPushNotificationConfig(self, request, context):
        """Set a push notification config for a task."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def GetTaskPushNotificationConfig(self, request, context):
        """Get a push notification config for a task."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def ListTaskPushNotificationConfig(self, request, context):
        """Get a list of push notifications configured for a task."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def GetExtendedAgentCard(self, request, context):
        """GetExtendedAgentCard returns the extended agent card for authenticated agents."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def DeleteTaskPushNotificationConfig(self, request, context):
        """Delete a push notification config for a task."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_A2AServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
        "SendMessage": grpc.unary_unary_rpc_method_handler(
            servicer.SendMessage,
            request_deserializer=a2a__pb2.SendMessageRequest.FromString,
            response_serializer=a2a__pb2.SendMessageResponse.SerializeToString,
        ),
        "SendStreamingMessage": grpc.unary_stream_rpc_method_handler(
            servicer.SendStreamingMessage,
            request_deserializer=a2a__pb2.SendMessageRequest.FromString,
            response_serializer=a2a__pb2.StreamResponse.SerializeToString,
        ),
        "GetTask": grpc.unary_unary_rpc_method_handler(
            servicer.GetTask,
            request_deserializer=a2a__pb2.GetTaskRequest.FromString,
            response_serializer=a2a__pb2.Task.SerializeToString,
        ),
        "ListTasks": grpc.unary_unary_rpc_method_handler(
            servicer.ListTasks,
            request_deserializer=a2a__pb2.ListTasksRequest.FromString,
            response_serializer=a2a__pb2.ListTasksResponse.SerializeToString,
        ),
        "CancelTask": grpc.unary_unary_rpc_method_handler(
            servicer.CancelTask,
            request_deserializer=a2a__pb2.CancelTaskRequest.FromString,
            response_serializer=a2a__pb2.Task.SerializeToString,
        ),
        "SubscribeToTask": grpc.unary_stream_rpc_method_handler(
            servicer.SubscribeToTask,
            request_deserializer=a2a__pb2.SubscribeToTaskRequest.FromString,
            response_serializer=a2a__pb2.StreamResponse.SerializeToString,
        ),
        "SetTaskPushNotificationConfig": grpc.unary_unary_rpc_method_handler(
            servicer.SetTaskPushNotificationConfig,
            request_deserializer=a2a__pb2.SetTaskPushNotificationConfigRequest.FromString,
            response_serializer=a2a__pb2.TaskPushNotificationConfig.SerializeToString,
        ),
        "GetTaskPushNotificationConfig": grpc.unary_unary_rpc_method_handler(
            servicer.GetTaskPushNotificationConfig,
            request_deserializer=a2a__pb2.GetTaskPushNotificationConfigRequest.FromString,
            response_serializer=a2a__pb2.TaskPushNotificationConfig.SerializeToString,
        ),
        "ListTaskPushNotificationConfig": grpc.unary_unary_rpc_method_handler(
            servicer.ListTaskPushNotificationConfig,
            request_deserializer=a2a__pb2.ListTaskPushNotificationConfigRequest.FromString,
            response_serializer=a2a__pb2.ListTaskPushNotificationConfigResponse.SerializeToString,
        ),
        "GetExtendedAgentCard": grpc.unary_unary_rpc_method_handler(
            servicer.GetExtendedAgentCard,
            request_deserializer=a2a__pb2.GetExtendedAgentCardRequest.FromString,
            response_serializer=a2a__pb2.AgentCard.SerializeToString,
        ),
        "DeleteTaskPushNotificationConfig": grpc.unary_unary_rpc_method_handler(
            servicer.DeleteTaskPushNotificationConfig,
            request_deserializer=a2a__pb2.DeleteTaskPushNotificationConfigRequest.FromString,
            response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler("a2a.v1.A2AService", rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers("a2a.v1.A2AService", rpc_method_handlers)


# This class is part of an EXPERIMENTAL API.
class A2AService(object):
    """A2AService defines the operations of the A2A protocol."""

    @staticmethod
    def SendMessage(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/a2a.v1.A2AService/SendMessage",
            a2a__pb2.SendMessageRequest.SerializeToString,
            a2a__pb2.SendMessageResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def SendStreamingMessage(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_stream(
            request,
            target,
            "/a2a.v1.A2AService/SendStreamingMessage",
            a2a__pb2.SendMessageRequest.SerializeToString,
            a2a__pb2.StreamResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def GetTask(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/a2a.v1.A2AService/GetTask",
            a2a__pb2.GetTaskRequest.SerializeToString,
            a2a__pb2.Task.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def ListTasks(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/a2a.v1.A2AService/ListTasks",
            a2a__pb2.ListTasksRequest.SerializeToString,
            a2a__pb2.ListTasksResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def CancelTask(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/a2a.v1.A2AService/CancelTask",
            a2a__pb2.CancelTaskRequest.SerializeToString,
            a2a__pb2.Task.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def SubscribeToTask(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_stream(
            request,
            target,
            "/a2a.v1.A2AService/SubscribeToTask",
            a2a__pb2.SubscribeToTaskRequest.SerializeToString,
            a2a__pb2.StreamResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def SetTaskPushNotificationConfig(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/a2a.v1.A2AService/SetTaskPushNotificationConfig",
            a2a__pb2.SetTaskPushNotificationConfigRequest.SerializeToString,
            a2a__pb2.TaskPushNotificationConfig.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def GetTaskPushNotificationConfig(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/a2a.v1.A2AService/GetTaskPushNotificationConfig",
            a2a__pb2.GetTaskPushNotificationConfigRequest.SerializeToString,
            a2a__pb2.TaskPushNotificationConfig.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def ListTaskPushNotificationConfig(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/a2a.v1.A2AService/ListTaskPushNotificationConfig",
            a2a__pb2.ListTaskPushNotificationConfigRequest.SerializeToString,
            a2a__pb2.ListTaskPushNotificationConfigResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def GetExtendedAgentCard(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/a2a.v1.A2AService/GetExtendedAgentCard",
            a2a__pb2.GetExtendedAgentCardRequest.SerializeToString,
            a2a__pb2.AgentCard.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def DeleteTaskPushNotificationConfig(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/a2a.v1.A2AService/DeleteTaskPushNotificationConfig",
            a2a__pb2.DeleteTaskPushNotificationConfigRequest.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )
