# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2019
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""

import grpc

import tests.apps.grpc_server.stan_pb2 as stan__pb2

GRPC_GENERATED_VERSION = "1.67.1"
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 stan_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 StanStub(object):
    """Missing associated documentation comment in .proto file."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.OneQuestionOneResponse = channel.unary_unary(
            "/stan.Stan/OneQuestionOneResponse",
            request_serializer=stan__pb2.QuestionRequest.SerializeToString,
            response_deserializer=stan__pb2.QuestionResponse.FromString,
            _registered_method=True,
        )
        self.ManyQuestionsOneResponse = channel.stream_unary(
            "/stan.Stan/ManyQuestionsOneResponse",
            request_serializer=stan__pb2.QuestionRequest.SerializeToString,
            response_deserializer=stan__pb2.QuestionResponse.FromString,
            _registered_method=True,
        )
        self.OneQuestionManyResponses = channel.unary_stream(
            "/stan.Stan/OneQuestionManyResponses",
            request_serializer=stan__pb2.QuestionRequest.SerializeToString,
            response_deserializer=stan__pb2.QuestionResponse.FromString,
            _registered_method=True,
        )
        self.ManyQuestionsManyReponses = channel.stream_stream(
            "/stan.Stan/ManyQuestionsManyReponses",
            request_serializer=stan__pb2.QuestionRequest.SerializeToString,
            response_deserializer=stan__pb2.QuestionResponse.FromString,
            _registered_method=True,
        )
        self.OneQuestionOneErrorResponse = channel.unary_unary(
            "/stan.Stan/OneQuestionOneErrorResponse",
            request_serializer=stan__pb2.QuestionRequest.SerializeToString,
            response_deserializer=stan__pb2.QuestionResponse.FromString,
            _registered_method=True,
        )
        self.OneErroredQuestionOneResponse = channel.unary_unary(
            "/stan.Stan/OneErroredQuestionOneResponse",
            request_serializer=stan__pb2.QuestionRequest.SerializeToString,
            response_deserializer=stan__pb2.QuestionResponse.FromString,
            _registered_method=True,
        )


class StanServicer(object):
    """Missing associated documentation comment in .proto file."""

    def OneQuestionOneResponse(self, request, context):
        """Unary"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def ManyQuestionsOneResponse(self, request_iterator, context):
        """Streaming"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def OneQuestionManyResponses(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def ManyQuestionsManyReponses(self, request_iterator, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def OneQuestionOneErrorResponse(self, request, context):
        """Error Testing"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def OneErroredQuestionOneResponse(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_StanServicer_to_server(servicer, server):
    rpc_method_handlers = {
        "OneQuestionOneResponse": grpc.unary_unary_rpc_method_handler(
            servicer.OneQuestionOneResponse,
            request_deserializer=stan__pb2.QuestionRequest.FromString,
            response_serializer=stan__pb2.QuestionResponse.SerializeToString,
        ),
        "ManyQuestionsOneResponse": grpc.stream_unary_rpc_method_handler(
            servicer.ManyQuestionsOneResponse,
            request_deserializer=stan__pb2.QuestionRequest.FromString,
            response_serializer=stan__pb2.QuestionResponse.SerializeToString,
        ),
        "OneQuestionManyResponses": grpc.unary_stream_rpc_method_handler(
            servicer.OneQuestionManyResponses,
            request_deserializer=stan__pb2.QuestionRequest.FromString,
            response_serializer=stan__pb2.QuestionResponse.SerializeToString,
        ),
        "ManyQuestionsManyReponses": grpc.stream_stream_rpc_method_handler(
            servicer.ManyQuestionsManyReponses,
            request_deserializer=stan__pb2.QuestionRequest.FromString,
            response_serializer=stan__pb2.QuestionResponse.SerializeToString,
        ),
        "OneQuestionOneErrorResponse": grpc.unary_unary_rpc_method_handler(
            servicer.OneQuestionOneErrorResponse,
            request_deserializer=stan__pb2.QuestionRequest.FromString,
            response_serializer=stan__pb2.QuestionResponse.SerializeToString,
        ),
        "OneErroredQuestionOneResponse": grpc.unary_unary_rpc_method_handler(
            servicer.OneErroredQuestionOneResponse,
            request_deserializer=stan__pb2.QuestionRequest.FromString,
            response_serializer=stan__pb2.QuestionResponse.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        "stan.Stan", rpc_method_handlers
    )
    server.add_generic_rpc_handlers((generic_handler,))
