# 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 truffle.app import task_runtime_pb2 as truffle_dot_app_dot_task__runtime__pb2
from truffle.os import task_actions_pb2 as truffle_dot_os_dot_task__actions__pb2
from truffle.os import task_user_response_pb2 as truffle_dot_os_dot_task__user__response__pb2

GRPC_GENERATED_VERSION = '1.72.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 truffle/app/task_runtime_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 TaskRuntimeServiceStub(object):
    """task == foreground app, bear with me 
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.OpenTask = channel.unary_stream(
                '/truffle.app.TaskRuntimeService/OpenTask',
                request_serializer=truffle_dot_app_dot_task__runtime__pb2.StartTaskRequest.SerializeToString,
                response_deserializer=truffle_dot_app_dot_task__runtime__pb2.TaskRuntimeUpdate.FromString,
                _registered_method=True)
        self.HandleInterrupt = channel.unary_unary(
                '/truffle.app.TaskRuntimeService/HandleInterrupt',
                request_serializer=truffle_dot_os_dot_task__actions__pb2.InterruptTaskRequest.SerializeToString,
                response_deserializer=truffle_dot_os_dot_task__actions__pb2.TaskActionResponse.FromString,
                _registered_method=True)
        self.HandleUserResponse = channel.unary_unary(
                '/truffle.app.TaskRuntimeService/HandleUserResponse',
                request_serializer=truffle_dot_os_dot_task__user__response__pb2.RespondToTaskRequest.SerializeToString,
                response_deserializer=truffle_dot_os_dot_task__actions__pb2.TaskActionResponse.FromString,
                _registered_method=True)
        self.AddToolProvider = channel.unary_unary(
                '/truffle.app.TaskRuntimeService/AddToolProvider',
                request_serializer=truffle_dot_app_dot_task__runtime__pb2.AddToolProviderRequest.SerializeToString,
                response_deserializer=truffle_dot_app_dot_task__runtime__pb2.AddToolProviderResponse.FromString,
                _registered_method=True)
        self.RemoveToolProvider = channel.unary_unary(
                '/truffle.app.TaskRuntimeService/RemoveToolProvider',
                request_serializer=truffle_dot_app_dot_task__runtime__pb2.RemoveToolProviderRequest.SerializeToString,
                response_deserializer=truffle_dot_app_dot_task__runtime__pb2.RemoveToolProviderResponse.FromString,
                _registered_method=True)


class TaskRuntimeServiceServicer(object):
    """task == foreground app, bear with me 
    """

    def OpenTask(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 HandleInterrupt(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 HandleUserResponse(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 AddToolProvider(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 RemoveToolProvider(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_TaskRuntimeServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'OpenTask': grpc.unary_stream_rpc_method_handler(
                    servicer.OpenTask,
                    request_deserializer=truffle_dot_app_dot_task__runtime__pb2.StartTaskRequest.FromString,
                    response_serializer=truffle_dot_app_dot_task__runtime__pb2.TaskRuntimeUpdate.SerializeToString,
            ),
            'HandleInterrupt': grpc.unary_unary_rpc_method_handler(
                    servicer.HandleInterrupt,
                    request_deserializer=truffle_dot_os_dot_task__actions__pb2.InterruptTaskRequest.FromString,
                    response_serializer=truffle_dot_os_dot_task__actions__pb2.TaskActionResponse.SerializeToString,
            ),
            'HandleUserResponse': grpc.unary_unary_rpc_method_handler(
                    servicer.HandleUserResponse,
                    request_deserializer=truffle_dot_os_dot_task__user__response__pb2.RespondToTaskRequest.FromString,
                    response_serializer=truffle_dot_os_dot_task__actions__pb2.TaskActionResponse.SerializeToString,
            ),
            'AddToolProvider': grpc.unary_unary_rpc_method_handler(
                    servicer.AddToolProvider,
                    request_deserializer=truffle_dot_app_dot_task__runtime__pb2.AddToolProviderRequest.FromString,
                    response_serializer=truffle_dot_app_dot_task__runtime__pb2.AddToolProviderResponse.SerializeToString,
            ),
            'RemoveToolProvider': grpc.unary_unary_rpc_method_handler(
                    servicer.RemoveToolProvider,
                    request_deserializer=truffle_dot_app_dot_task__runtime__pb2.RemoveToolProviderRequest.FromString,
                    response_serializer=truffle_dot_app_dot_task__runtime__pb2.RemoveToolProviderResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'truffle.app.TaskRuntimeService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('truffle.app.TaskRuntimeService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class TaskRuntimeService(object):
    """task == foreground app, bear with me 
    """

    @staticmethod
    def OpenTask(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,
            '/truffle.app.TaskRuntimeService/OpenTask',
            truffle_dot_app_dot_task__runtime__pb2.StartTaskRequest.SerializeToString,
            truffle_dot_app_dot_task__runtime__pb2.TaskRuntimeUpdate.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def HandleInterrupt(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,
            '/truffle.app.TaskRuntimeService/HandleInterrupt',
            truffle_dot_os_dot_task__actions__pb2.InterruptTaskRequest.SerializeToString,
            truffle_dot_os_dot_task__actions__pb2.TaskActionResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def HandleUserResponse(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,
            '/truffle.app.TaskRuntimeService/HandleUserResponse',
            truffle_dot_os_dot_task__user__response__pb2.RespondToTaskRequest.SerializeToString,
            truffle_dot_os_dot_task__actions__pb2.TaskActionResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def AddToolProvider(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,
            '/truffle.app.TaskRuntimeService/AddToolProvider',
            truffle_dot_app_dot_task__runtime__pb2.AddToolProviderRequest.SerializeToString,
            truffle_dot_app_dot_task__runtime__pb2.AddToolProviderResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def RemoveToolProvider(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,
            '/truffle.app.TaskRuntimeService/RemoveToolProvider',
            truffle_dot_app_dot_task__runtime__pb2.RemoveToolProviderRequest.SerializeToString,
            truffle_dot_app_dot_task__runtime__pb2.RemoveToolProviderResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
