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

# Local
from . import model_mesh_pb2 as model__mesh__pb2


class ModelMeshStub(object):
    """this is a grpc version of the external model-mesh interface
    for managing and serving models
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.registerModel = channel.unary_unary(
            "/mmesh.ModelMesh/registerModel",
            request_serializer=model__mesh__pb2.RegisterModelRequest.SerializeToString,
            response_deserializer=model__mesh__pb2.ModelStatusInfo.FromString,
        )
        self.unregisterModel = channel.unary_unary(
            "/mmesh.ModelMesh/unregisterModel",
            request_serializer=model__mesh__pb2.UnregisterModelRequest.SerializeToString,
            response_deserializer=model__mesh__pb2.UnregisterModelResponse.FromString,
        )
        self.getModelStatus = channel.unary_unary(
            "/mmesh.ModelMesh/getModelStatus",
            request_serializer=model__mesh__pb2.GetStatusRequest.SerializeToString,
            response_deserializer=model__mesh__pb2.ModelStatusInfo.FromString,
        )
        self.ensureLoaded = channel.unary_unary(
            "/mmesh.ModelMesh/ensureLoaded",
            request_serializer=model__mesh__pb2.EnsureLoadedRequest.SerializeToString,
            response_deserializer=model__mesh__pb2.ModelStatusInfo.FromString,
        )
        self.setVModel = channel.unary_unary(
            "/mmesh.ModelMesh/setVModel",
            request_serializer=model__mesh__pb2.SetVModelRequest.SerializeToString,
            response_deserializer=model__mesh__pb2.VModelStatusInfo.FromString,
        )
        self.deleteVModel = channel.unary_unary(
            "/mmesh.ModelMesh/deleteVModel",
            request_serializer=model__mesh__pb2.DeleteVModelRequest.SerializeToString,
            response_deserializer=model__mesh__pb2.DeleteVModelResponse.FromString,
        )
        self.getVModelStatus = channel.unary_unary(
            "/mmesh.ModelMesh/getVModelStatus",
            request_serializer=model__mesh__pb2.GetVModelStatusRequest.SerializeToString,
            response_deserializer=model__mesh__pb2.VModelStatusInfo.FromString,
        )


class ModelMeshServicer(object):
    """this is a grpc version of the external model-mesh interface
    for managing and serving models
    """

    def registerModel(self, request, context):
        """model lifecycle rpcs

        Registers a trained model to this model-mesh cluster
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def unregisterModel(self, request, context):
        """Unregisters (deletes) a model from this model-mesh cluster,
        has no effect if the specified model isn't found
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def getModelStatus(self, request, context):
        """Returns the status of the specified model. See the ModelStatus enum"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def ensureLoaded(self, request, context):
        """Ensures the model with the specified id is loaded in this model-mesh cluster"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def setVModel(self, request, context):
        """vmodel lifecycle rpcs

        Creates a new vmodel id (alias) which maps to a new or existing
        concrete model, or sets the target model for an existing vmodel
        to a new or existing concrete model
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def deleteVModel(self, request, context):
        """Deletes a vmodel, optionally deleting any referenced concrete
        models at the same time
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def getVModelStatus(self, request, context):
        """Gets the status of a vmodel, including associated target/active model ids
        If the vmodel is not found, the returned VModelStatusInfo will have empty
        active and target model ids and an active model status of NOT_FOUND
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_ModelMeshServicer_to_server(servicer, server):
    rpc_method_handlers = {
        "registerModel": grpc.unary_unary_rpc_method_handler(
            servicer.registerModel,
            request_deserializer=model__mesh__pb2.RegisterModelRequest.FromString,
            response_serializer=model__mesh__pb2.ModelStatusInfo.SerializeToString,
        ),
        "unregisterModel": grpc.unary_unary_rpc_method_handler(
            servicer.unregisterModel,
            request_deserializer=model__mesh__pb2.UnregisterModelRequest.FromString,
            response_serializer=model__mesh__pb2.UnregisterModelResponse.SerializeToString,
        ),
        "getModelStatus": grpc.unary_unary_rpc_method_handler(
            servicer.getModelStatus,
            request_deserializer=model__mesh__pb2.GetStatusRequest.FromString,
            response_serializer=model__mesh__pb2.ModelStatusInfo.SerializeToString,
        ),
        "ensureLoaded": grpc.unary_unary_rpc_method_handler(
            servicer.ensureLoaded,
            request_deserializer=model__mesh__pb2.EnsureLoadedRequest.FromString,
            response_serializer=model__mesh__pb2.ModelStatusInfo.SerializeToString,
        ),
        "setVModel": grpc.unary_unary_rpc_method_handler(
            servicer.setVModel,
            request_deserializer=model__mesh__pb2.SetVModelRequest.FromString,
            response_serializer=model__mesh__pb2.VModelStatusInfo.SerializeToString,
        ),
        "deleteVModel": grpc.unary_unary_rpc_method_handler(
            servicer.deleteVModel,
            request_deserializer=model__mesh__pb2.DeleteVModelRequest.FromString,
            response_serializer=model__mesh__pb2.DeleteVModelResponse.SerializeToString,
        ),
        "getVModelStatus": grpc.unary_unary_rpc_method_handler(
            servicer.getVModelStatus,
            request_deserializer=model__mesh__pb2.GetVModelStatusRequest.FromString,
            response_serializer=model__mesh__pb2.VModelStatusInfo.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        "mmesh.ModelMesh", rpc_method_handlers
    )
    server.add_generic_rpc_handlers((generic_handler,))


# This class is part of an EXPERIMENTAL API.
class ModelMesh(object):
    """this is a grpc version of the external model-mesh interface
    for managing and serving models
    """

    @staticmethod
    def registerModel(
        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,
            "/mmesh.ModelMesh/registerModel",
            model__mesh__pb2.RegisterModelRequest.SerializeToString,
            model__mesh__pb2.ModelStatusInfo.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def unregisterModel(
        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,
            "/mmesh.ModelMesh/unregisterModel",
            model__mesh__pb2.UnregisterModelRequest.SerializeToString,
            model__mesh__pb2.UnregisterModelResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def getModelStatus(
        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,
            "/mmesh.ModelMesh/getModelStatus",
            model__mesh__pb2.GetStatusRequest.SerializeToString,
            model__mesh__pb2.ModelStatusInfo.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def ensureLoaded(
        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,
            "/mmesh.ModelMesh/ensureLoaded",
            model__mesh__pb2.EnsureLoadedRequest.SerializeToString,
            model__mesh__pb2.ModelStatusInfo.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def setVModel(
        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,
            "/mmesh.ModelMesh/setVModel",
            model__mesh__pb2.SetVModelRequest.SerializeToString,
            model__mesh__pb2.VModelStatusInfo.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def deleteVModel(
        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,
            "/mmesh.ModelMesh/deleteVModel",
            model__mesh__pb2.DeleteVModelRequest.SerializeToString,
            model__mesh__pb2.DeleteVModelResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def getVModelStatus(
        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,
            "/mmesh.ModelMesh/getVModelStatus",
            model__mesh__pb2.GetVModelStatusRequest.SerializeToString,
            model__mesh__pb2.VModelStatusInfo.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )
