# 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 farm_ng.core import event_service_pb2 as farm__ng_dot_core_dot_event__service__pb2

GRPC_GENERATED_VERSION = '1.65.1'
GRPC_VERSION = grpc.__version__
EXPECTED_ERROR_RELEASE = '1.66.0'
SCHEDULED_RELEASE_DATE = 'August 6, 2024'
_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:
    warnings.warn(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + f' but the generated code in farm_ng/core/event_service_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}.'
        + f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
        + f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
        RuntimeWarning
    )


class EventServiceStub(object):
    """EventService is a generic service for publishing and subscribing to events.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.listUris = channel.unary_unary(
                '/farm_ng.core.proto.EventService/listUris',
                request_serializer=farm__ng_dot_core_dot_event__service__pb2.ListUrisRequest.SerializeToString,
                response_deserializer=farm__ng_dot_core_dot_event__service__pb2.ListUrisReply.FromString,
                _registered_method=True)
        self.subscribe = channel.unary_stream(
                '/farm_ng.core.proto.EventService/subscribe',
                request_serializer=farm__ng_dot_core_dot_event__service__pb2.SubscribeRequest.SerializeToString,
                response_deserializer=farm__ng_dot_core_dot_event__service__pb2.SubscribeReply.FromString,
                _registered_method=True)
        self.requestReply = channel.unary_unary(
                '/farm_ng.core.proto.EventService/requestReply',
                request_serializer=farm__ng_dot_core_dot_event__service__pb2.RequestReplyRequest.SerializeToString,
                response_deserializer=farm__ng_dot_core_dot_event__service__pb2.RequestReplyReply.FromString,
                _registered_method=True)


class EventServiceServicer(object):
    """EventService is a generic service for publishing and subscribing to events.
    """

    def listUris(self, request, context):
        """return a list of all the URIs this service can publish
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def subscribe(self, request, context):
        """subscribe to single URI topic
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def requestReply(self, request, context):
        """send a single message request/reply
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_EventServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'listUris': grpc.unary_unary_rpc_method_handler(
                    servicer.listUris,
                    request_deserializer=farm__ng_dot_core_dot_event__service__pb2.ListUrisRequest.FromString,
                    response_serializer=farm__ng_dot_core_dot_event__service__pb2.ListUrisReply.SerializeToString,
            ),
            'subscribe': grpc.unary_stream_rpc_method_handler(
                    servicer.subscribe,
                    request_deserializer=farm__ng_dot_core_dot_event__service__pb2.SubscribeRequest.FromString,
                    response_serializer=farm__ng_dot_core_dot_event__service__pb2.SubscribeReply.SerializeToString,
            ),
            'requestReply': grpc.unary_unary_rpc_method_handler(
                    servicer.requestReply,
                    request_deserializer=farm__ng_dot_core_dot_event__service__pb2.RequestReplyRequest.FromString,
                    response_serializer=farm__ng_dot_core_dot_event__service__pb2.RequestReplyReply.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'farm_ng.core.proto.EventService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('farm_ng.core.proto.EventService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class EventService(object):
    """EventService is a generic service for publishing and subscribing to events.
    """

    @staticmethod
    def listUris(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,
            '/farm_ng.core.proto.EventService/listUris',
            farm__ng_dot_core_dot_event__service__pb2.ListUrisRequest.SerializeToString,
            farm__ng_dot_core_dot_event__service__pb2.ListUrisReply.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def subscribe(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,
            '/farm_ng.core.proto.EventService/subscribe',
            farm__ng_dot_core_dot_event__service__pb2.SubscribeRequest.SerializeToString,
            farm__ng_dot_core_dot_event__service__pb2.SubscribeReply.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def requestReply(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,
            '/farm_ng.core.proto.EventService/requestReply',
            farm__ng_dot_core_dot_event__service__pb2.RequestReplyRequest.SerializeToString,
            farm__ng_dot_core_dot_event__service__pb2.RequestReplyReply.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
