# /*
#  * Copyright 2024 KylinSoft Co., Ltd.
#  *
#  * This program is free software: you can redistribute it and/or modify it under
#  * the terms of the GNU General Public License as published by the Free Software
#  * Foundation, either version 3 of the License, or (at your option) any later
#  * version.
#  *
#  * This program is distributed in the hope that it will be useful, but WITHOUT
#  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
#  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
#  * details.
#  *
#  * You should have received a copy of the GNU General Public License along with
#  * this program. If not, see <https://www.gnu.org/licenses/>.
#  */

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

import document_pb2 as document__pb2

GRPC_GENERATED_VERSION = '1.66.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},'
        + f' but the generated code in document_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 DocumentServiceStub(object):
    """定义服务
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.SyncChunkDocument = channel.unary_unary(
                '/document.DocumentService/SyncChunkDocument',
                request_serializer=document__pb2.ChunkRequest.SerializeToString,
                response_deserializer=document__pb2.ChunkedResponse.FromString,
                _registered_method=True)
        self.AsyncChunkDocument = channel.unary_unary(
                '/document.DocumentService/AsyncChunkDocument',
                request_serializer=document__pb2.ChunkRequest.SerializeToString,
                response_deserializer=document__pb2.ChunkedResponse.FromString,
                _registered_method=True)
        self.StreamChunkDocument = channel.unary_stream(
                '/document.DocumentService/StreamChunkDocument',
                request_serializer=document__pb2.ChunkRequest.SerializeToString,
                response_deserializer=document__pb2.ChunkedResponse.FromString,
                _registered_method=True)


class DocumentServiceServicer(object):
    """定义服务
    """

    def SyncChunkDocument(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 AsyncChunkDocument(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 StreamChunkDocument(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_DocumentServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'SyncChunkDocument': grpc.unary_unary_rpc_method_handler(
                    servicer.SyncChunkDocument,
                    request_deserializer=document__pb2.ChunkRequest.FromString,
                    response_serializer=document__pb2.ChunkedResponse.SerializeToString,
            ),
            'AsyncChunkDocument': grpc.unary_unary_rpc_method_handler(
                    servicer.AsyncChunkDocument,
                    request_deserializer=document__pb2.ChunkRequest.FromString,
                    response_serializer=document__pb2.ChunkedResponse.SerializeToString,
            ),
            'StreamChunkDocument': grpc.unary_stream_rpc_method_handler(
                    servicer.StreamChunkDocument,
                    request_deserializer=document__pb2.ChunkRequest.FromString,
                    response_serializer=document__pb2.ChunkedResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'document.DocumentService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('document.DocumentService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class DocumentService(object):
    """定义服务
    """

    @staticmethod
    def SyncChunkDocument(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,
            '/document.DocumentService/SyncChunkDocument',
            document__pb2.ChunkRequest.SerializeToString,
            document__pb2.ChunkedResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def AsyncChunkDocument(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,
            '/document.DocumentService/AsyncChunkDocument',
            document__pb2.ChunkRequest.SerializeToString,
            document__pb2.ChunkedResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StreamChunkDocument(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,
            '/document.DocumentService/StreamChunkDocument',
            document__pb2.ChunkRequest.SerializeToString,
            document__pb2.ChunkedResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
