# 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 google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
from . import receiver_pb2 as receiver__pb2

GRPC_GENERATED_VERSION = "1.67.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},"
        + f" but the generated code in receiver_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 ReceiverStub(object):
    """Receiver service definition.

    The receiver service is used to receive an approval requests from the
    client SDK. This requests can then be relayed to the coordinator service
    to be dispatched to the appropriate approvers.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Heartbeat = channel.unary_unary(
            "/receiver.Receiver/Heartbeat",
            request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            response_deserializer=receiver__pb2.HeartbeatResponse.FromString,
            _registered_method=True,
        )
        self.GetApproval = channel.unary_unary(
            "/receiver.Receiver/GetApproval",
            request_serializer=receiver__pb2.GetApprovalRequest.SerializeToString,
            response_deserializer=receiver__pb2.GetApprovalResponse.FromString,
            _registered_method=True,
        )


class ReceiverServicer(object):
    """Receiver service definition.

    The receiver service is used to receive an approval requests from the
    client SDK. This requests can then be relayed to the coordinator service
    to be dispatched to the appropriate approvers.
    """

    def Heartbeat(self, request, context):
        """Check if the receiver service is running."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def GetApproval(self, request, context):
        """Create a new approval request for the approvers to review."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_ReceiverServicer_to_server(servicer, server):
    rpc_method_handlers = {
        "Heartbeat": grpc.unary_unary_rpc_method_handler(
            servicer.Heartbeat,
            request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            response_serializer=receiver__pb2.HeartbeatResponse.SerializeToString,
        ),
        "GetApproval": grpc.unary_unary_rpc_method_handler(
            servicer.GetApproval,
            request_deserializer=receiver__pb2.GetApprovalRequest.FromString,
            response_serializer=receiver__pb2.GetApprovalResponse.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        "receiver.Receiver", rpc_method_handlers
    )
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers(
        "receiver.Receiver", rpc_method_handlers
    )


# This class is part of an EXPERIMENTAL API.
class Receiver(object):
    """Receiver service definition.

    The receiver service is used to receive an approval requests from the
    client SDK. This requests can then be relayed to the coordinator service
    to be dispatched to the appropriate approvers.
    """

    @staticmethod
    def Heartbeat(
        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,
            "/receiver.Receiver/Heartbeat",
            google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            receiver__pb2.HeartbeatResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def GetApproval(
        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,
            "/receiver.Receiver/GetApproval",
            receiver__pb2.GetApprovalRequest.SerializeToString,
            receiver__pb2.GetApprovalResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )
