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

from . import threads_pb2 as threads__pb2


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

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

        Args:
            channel: A grpc.Channel.
        """
        self.GetThread = channel.unary_unary(
                '/org.couchers.api.threads.Threads/GetThread',
                request_serializer=threads__pb2.GetThreadReq.SerializeToString,
                response_deserializer=threads__pb2.GetThreadRes.FromString,
                )
        self.PostReply = channel.unary_unary(
                '/org.couchers.api.threads.Threads/PostReply',
                request_serializer=threads__pb2.PostReplyReq.SerializeToString,
                response_deserializer=threads__pb2.PostReplyRes.FromString,
                )


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

    def GetThread(self, request, context):
        """Discussion threads are organized as a tree with maximum three levels depth:
        thread1
        +- comment1
        |  +- reply1
        |  +- reply2
        +- comment2
        +- reply3
        +- reply4
        thread2
        +- comment3
        |  +- reply5
        |  +- reply6
        +- comment4
        +- reply7
        +- reply8

        The same API is used regardless of level. All posts are using the same id namespace.

        Get non-deleted posts belonging to a thread, sorted in reverse time order.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def PostReply(self, request, context):
        """Post a new comment on a thread. The post can not be changed or deleted after posting.
        Throws NOT_FOUND if thread_id corresponds to a nesting level 3 reply, since no futher nesting is allowed.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ThreadsServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetThread': grpc.unary_unary_rpc_method_handler(
                    servicer.GetThread,
                    request_deserializer=threads__pb2.GetThreadReq.FromString,
                    response_serializer=threads__pb2.GetThreadRes.SerializeToString,
            ),
            'PostReply': grpc.unary_unary_rpc_method_handler(
                    servicer.PostReply,
                    request_deserializer=threads__pb2.PostReplyReq.FromString,
                    response_serializer=threads__pb2.PostReplyRes.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'org.couchers.api.threads.Threads', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class Threads(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def GetThread(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, '/org.couchers.api.threads.Threads/GetThread',
            threads__pb2.GetThreadReq.SerializeToString,
            threads__pb2.GetThreadRes.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def PostReply(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, '/org.couchers.api.threads.Threads/PostReply',
            threads__pb2.PostReplyReq.SerializeToString,
            threads__pb2.PostReplyRes.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
