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

try:
    from . import tts_pb2 as tts__pb2
except ImportError:
    import tts_pb2 as tts__pb2

GRPC_GENERATED_VERSION = '1.76.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},'
        + ' but the generated code in tts_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 TTSServiceStub(object):
    """Kokoro TTS Service Definition
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.CreateSession = channel.unary_unary(
                '/kokoro.TTSService/CreateSession',
                request_serializer=tts__pb2.CreateSessionRequest.SerializeToString,
                response_deserializer=tts__pb2.CreateSessionResponse.FromString,
                _registered_method=True)
        self.Synthesize = channel.unary_stream(
                '/kokoro.TTSService/Synthesize',
                request_serializer=tts__pb2.SynthesizeRequest.SerializeToString,
                response_deserializer=tts__pb2.SynthesizeResponse.FromString,
                _registered_method=True)
        self.GetVoices = channel.unary_unary(
                '/kokoro.TTSService/GetVoices',
                request_serializer=tts__pb2.Empty.SerializeToString,
                response_deserializer=tts__pb2.VoicesResponse.FromString,
                _registered_method=True)
        self.DestroySession = channel.unary_unary(
                '/kokoro.TTSService/DestroySession',
                request_serializer=tts__pb2.DestroySessionRequest.SerializeToString,
                response_deserializer=tts__pb2.Empty.FromString,
                _registered_method=True)
        self.GetStats = channel.unary_unary(
                '/kokoro.TTSService/GetStats',
                request_serializer=tts__pb2.Empty.SerializeToString,
                response_deserializer=tts__pb2.StatsResponse.FromString,
                _registered_method=True)


class TTSServiceServicer(object):
    """Kokoro TTS Service Definition
    """

    def CreateSession(self, request, context):
        """Create a new TTS session
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

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

    def GetVoices(self, request, context):
        """Get voice list
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def DestroySession(self, request, context):
        """Destroy a TTS session
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetStats(self, request, context):
        """Get service stats
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_TTSServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'CreateSession': grpc.unary_unary_rpc_method_handler(
                    servicer.CreateSession,
                    request_deserializer=tts__pb2.CreateSessionRequest.FromString,
                    response_serializer=tts__pb2.CreateSessionResponse.SerializeToString,
            ),
            'Synthesize': grpc.unary_stream_rpc_method_handler(
                    servicer.Synthesize,
                    request_deserializer=tts__pb2.SynthesizeRequest.FromString,
                    response_serializer=tts__pb2.SynthesizeResponse.SerializeToString,
            ),
            'GetVoices': grpc.unary_unary_rpc_method_handler(
                    servicer.GetVoices,
                    request_deserializer=tts__pb2.Empty.FromString,
                    response_serializer=tts__pb2.VoicesResponse.SerializeToString,
            ),
            'DestroySession': grpc.unary_unary_rpc_method_handler(
                    servicer.DestroySession,
                    request_deserializer=tts__pb2.DestroySessionRequest.FromString,
                    response_serializer=tts__pb2.Empty.SerializeToString,
            ),
            'GetStats': grpc.unary_unary_rpc_method_handler(
                    servicer.GetStats,
                    request_deserializer=tts__pb2.Empty.FromString,
                    response_serializer=tts__pb2.StatsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'kokoro.TTSService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('kokoro.TTSService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class TTSService(object):
    """Kokoro TTS Service Definition
    """

    @staticmethod
    def CreateSession(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,
            '/kokoro.TTSService/CreateSession',
            tts__pb2.CreateSessionRequest.SerializeToString,
            tts__pb2.CreateSessionResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Synthesize(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,
            '/kokoro.TTSService/Synthesize',
            tts__pb2.SynthesizeRequest.SerializeToString,
            tts__pb2.SynthesizeResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetVoices(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,
            '/kokoro.TTSService/GetVoices',
            tts__pb2.Empty.SerializeToString,
            tts__pb2.VoicesResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def DestroySession(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,
            '/kokoro.TTSService/DestroySession',
            tts__pb2.DestroySessionRequest.SerializeToString,
            tts__pb2.Empty.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetStats(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,
            '/kokoro.TTSService/GetStats',
            tts__pb2.Empty.SerializeToString,
            tts__pb2.StatsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
