# 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 terrascope_api.models import analysis_computation_pb2 as analysis__computation__pb2

GRPC_GENERATED_VERSION = '1.68.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 analysis_computation_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 AnalysisComputationApiStub(object):
    """Missing associated documentation comment in .proto file."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.create = channel.unary_unary(
                '/oi.papi.AnalysisComputationApi/create',
                request_serializer=analysis__computation__pb2.AnalysisComputationCreateRequest.SerializeToString,
                response_deserializer=analysis__computation__pb2.AnalysisComputationCreateResponse.FromString,
                _registered_method=True)
        self.run = channel.unary_unary(
                '/oi.papi.AnalysisComputationApi/run',
                request_serializer=analysis__computation__pb2.AnalysisComputationRunRequest.SerializeToString,
                response_deserializer=analysis__computation__pb2.AnalysisComputationRunResponse.FromString,
                _registered_method=True)
        self.get = channel.unary_unary(
                '/oi.papi.AnalysisComputationApi/get',
                request_serializer=analysis__computation__pb2.AnalysisComputationGetRequest.SerializeToString,
                response_deserializer=analysis__computation__pb2.AnalysisComputationGetResponse.FromString,
                _registered_method=True)
        self.list = channel.unary_unary(
                '/oi.papi.AnalysisComputationApi/list',
                request_serializer=analysis__computation__pb2.AnalysisComputationListRequest.SerializeToString,
                response_deserializer=analysis__computation__pb2.AnalysisComputationListResponse.FromString,
                _registered_method=True)


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

    def create(self, request, context):
        """
        Create the runnable component in the system, by specifying the Analysis to be run, the set of AOIs to be run on, and the TOI.
        The analysis_computation_id is returned so that it can be run.
        Note that until an AnalysisComputation has been run, its underlying resources are NOT locked and therefore can be changed.
        The names of an AlgorithmComputationNode must match that of it's corresponding Analysis' AnalysisAlgorithmNode.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def run(self, request, context):
        """
        The first time this endpoint is called, the system initiates the running of the provided analysis_computation_id.
        This causes credits to be place in pending status and eventually consumed when the AnalysisComputation completes.
        Credits are consumed as each result is produced. Once an Analysis has been run, all of its underlying constituent parts are considered locked and cannot be modified.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def get(self, request, context):
        """
        Retrieves the details of the provided AnalysisComputation including its current state and its progress.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def list(self, request, context):
        """
        Lists the details for all AnalysisComputations that the requester has access to including their current state and their progress.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_AnalysisComputationApiServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'create': grpc.unary_unary_rpc_method_handler(
                    servicer.create,
                    request_deserializer=analysis__computation__pb2.AnalysisComputationCreateRequest.FromString,
                    response_serializer=analysis__computation__pb2.AnalysisComputationCreateResponse.SerializeToString,
            ),
            'run': grpc.unary_unary_rpc_method_handler(
                    servicer.run,
                    request_deserializer=analysis__computation__pb2.AnalysisComputationRunRequest.FromString,
                    response_serializer=analysis__computation__pb2.AnalysisComputationRunResponse.SerializeToString,
            ),
            'get': grpc.unary_unary_rpc_method_handler(
                    servicer.get,
                    request_deserializer=analysis__computation__pb2.AnalysisComputationGetRequest.FromString,
                    response_serializer=analysis__computation__pb2.AnalysisComputationGetResponse.SerializeToString,
            ),
            'list': grpc.unary_unary_rpc_method_handler(
                    servicer.list,
                    request_deserializer=analysis__computation__pb2.AnalysisComputationListRequest.FromString,
                    response_serializer=analysis__computation__pb2.AnalysisComputationListResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'oi.papi.AnalysisComputationApi', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('oi.papi.AnalysisComputationApi', rpc_method_handlers)


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

    @staticmethod
    def create(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,
            '/oi.papi.AnalysisComputationApi/create',
            analysis__computation__pb2.AnalysisComputationCreateRequest.SerializeToString,
            analysis__computation__pb2.AnalysisComputationCreateResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def run(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,
            '/oi.papi.AnalysisComputationApi/run',
            analysis__computation__pb2.AnalysisComputationRunRequest.SerializeToString,
            analysis__computation__pb2.AnalysisComputationRunResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def get(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,
            '/oi.papi.AnalysisComputationApi/get',
            analysis__computation__pb2.AnalysisComputationGetRequest.SerializeToString,
            analysis__computation__pb2.AnalysisComputationGetResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def list(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,
            '/oi.papi.AnalysisComputationApi/list',
            analysis__computation__pb2.AnalysisComputationListRequest.SerializeToString,
            analysis__computation__pb2.AnalysisComputationListResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
