# 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 yandex.cloud.ai.tts.v3 import tts_pb2 as yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2

GRPC_GENERATED_VERSION = '1.70.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 yandex/cloud/ai/tts/v3/tts_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}.'
    )


class SynthesizerStub(object):
    """A set of methods for voice synthesis.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.UtteranceSynthesis = channel.unary_stream(
                '/speechkit.tts.v3.Synthesizer/UtteranceSynthesis',
                request_serializer=yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.UtteranceSynthesisRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.UtteranceSynthesisResponse.FromString,
                _registered_method=True)
        self.StreamSynthesis = channel.stream_stream(
                '/speechkit.tts.v3.Synthesizer/StreamSynthesis',
                request_serializer=yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.StreamSynthesisRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.StreamSynthesisResponse.FromString,
                _registered_method=True)


class SynthesizerServicer(object):
    """A set of methods for voice synthesis.
    """

    def UtteranceSynthesis(self, request, context):
        """Synthesizing text into speech.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def StreamSynthesis(self, request_iterator, context):
        """Bidirectional streaming RPC for real-time synthesis.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_SynthesizerServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'UtteranceSynthesis': grpc.unary_stream_rpc_method_handler(
                    servicer.UtteranceSynthesis,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.UtteranceSynthesisRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.UtteranceSynthesisResponse.SerializeToString,
            ),
            'StreamSynthesis': grpc.stream_stream_rpc_method_handler(
                    servicer.StreamSynthesis,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.StreamSynthesisRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.StreamSynthesisResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'speechkit.tts.v3.Synthesizer', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('speechkit.tts.v3.Synthesizer', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class Synthesizer(object):
    """A set of methods for voice synthesis.
    """

    @staticmethod
    def UtteranceSynthesis(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,
            '/speechkit.tts.v3.Synthesizer/UtteranceSynthesis',
            yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.UtteranceSynthesisRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.UtteranceSynthesisResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StreamSynthesis(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(
            request_iterator,
            target,
            '/speechkit.tts.v3.Synthesizer/StreamSynthesis',
            yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.StreamSynthesisRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_tts_dot_v3_dot_tts__pb2.StreamSynthesisResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
