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

from agntcy.dir.routing.v1 import publication_service_pb2 as agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2
from agntcy.dir.routing.v1 import routing_service_pb2 as agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2


class PublicationServiceStub(object):
    """PublicationService manages publication requests for announcing records to the DHT.

    Publications are stored in the database and processed by a worker that runs every hour.
    The publication workflow:
    1. Publications are created via routing's Publish RPC by specifying either a query, a list of CIDs, or all records
    2. Publication requests are added to the database
    3. PublicationWorker queries the data using the publication request from the database to get the list of CIDs to be published
    4. PublicationWorker announces the records with these CIDs to the DHT
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.CreatePublication = channel.unary_unary(
                '/agntcy.dir.routing.v1.PublicationService/CreatePublication',
                request_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.PublishRequest.SerializeToString,
                response_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.CreatePublicationResponse.FromString,
                _registered_method=True)
        self.ListPublications = channel.unary_stream(
                '/agntcy.dir.routing.v1.PublicationService/ListPublications',
                request_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.ListPublicationsRequest.SerializeToString,
                response_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.ListPublicationsItem.FromString,
                _registered_method=True)
        self.GetPublication = channel.unary_unary(
                '/agntcy.dir.routing.v1.PublicationService/GetPublication',
                request_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.GetPublicationRequest.SerializeToString,
                response_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.GetPublicationResponse.FromString,
                _registered_method=True)


class PublicationServiceServicer(object):
    """PublicationService manages publication requests for announcing records to the DHT.

    Publications are stored in the database and processed by a worker that runs every hour.
    The publication workflow:
    1. Publications are created via routing's Publish RPC by specifying either a query, a list of CIDs, or all records
    2. Publication requests are added to the database
    3. PublicationWorker queries the data using the publication request from the database to get the list of CIDs to be published
    4. PublicationWorker announces the records with these CIDs to the DHT
    """

    def CreatePublication(self, request, context):
        """CreatePublication creates a new publication request that will be processed by the PublicationWorker.
        The publication request can specify either a query, a list of specific CIDs, or all records to be announced to the DHT.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListPublications(self, request, context):
        """ListPublications returns a stream of all publication requests in the system.
        This allows monitoring of pending, processing, and completed publication requests.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetPublication(self, request, context):
        """GetPublication retrieves details of a specific publication request by its identifier.
        This includes the current status and any associated metadata.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_PublicationServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'CreatePublication': grpc.unary_unary_rpc_method_handler(
                    servicer.CreatePublication,
                    request_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.PublishRequest.FromString,
                    response_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.CreatePublicationResponse.SerializeToString,
            ),
            'ListPublications': grpc.unary_stream_rpc_method_handler(
                    servicer.ListPublications,
                    request_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.ListPublicationsRequest.FromString,
                    response_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.ListPublicationsItem.SerializeToString,
            ),
            'GetPublication': grpc.unary_unary_rpc_method_handler(
                    servicer.GetPublication,
                    request_deserializer=agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.GetPublicationRequest.FromString,
                    response_serializer=agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.GetPublicationResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'agntcy.dir.routing.v1.PublicationService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('agntcy.dir.routing.v1.PublicationService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class PublicationService(object):
    """PublicationService manages publication requests for announcing records to the DHT.

    Publications are stored in the database and processed by a worker that runs every hour.
    The publication workflow:
    1. Publications are created via routing's Publish RPC by specifying either a query, a list of CIDs, or all records
    2. Publication requests are added to the database
    3. PublicationWorker queries the data using the publication request from the database to get the list of CIDs to be published
    4. PublicationWorker announces the records with these CIDs to the DHT
    """

    @staticmethod
    def CreatePublication(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,
            '/agntcy.dir.routing.v1.PublicationService/CreatePublication',
            agntcy_dot_dir_dot_routing_dot_v1_dot_routing__service__pb2.PublishRequest.SerializeToString,
            agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.CreatePublicationResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListPublications(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,
            '/agntcy.dir.routing.v1.PublicationService/ListPublications',
            agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.ListPublicationsRequest.SerializeToString,
            agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.ListPublicationsItem.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetPublication(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,
            '/agntcy.dir.routing.v1.PublicationService/GetPublication',
            agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.GetPublicationRequest.SerializeToString,
            agntcy_dot_dir_dot_routing_dot_v1_dot_publication__service__pb2.GetPublicationResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
