# 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 hatchet_sdk.contracts.v1 import workflows_pb2 as v1_dot_workflows__pb2

GRPC_GENERATED_VERSION = '1.76.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},'
        + ' but the generated code in v1/workflows_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 AdminServiceStub(object):
    """AdminService represents a set of RPCs for admin management of tasks, workflows, etc.
    """

    def __init__(self, channel: grpc.Channel | grpc.aio.Channel) -> None:
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.PutWorkflow = channel.unary_unary(
                '/v1.AdminService/PutWorkflow',
                request_serializer=v1_dot_workflows__pb2.CreateWorkflowVersionRequest.SerializeToString,
                response_deserializer=v1_dot_workflows__pb2.CreateWorkflowVersionResponse.FromString,
                _registered_method=True)
        self.CancelTasks = channel.unary_unary(
                '/v1.AdminService/CancelTasks',
                request_serializer=v1_dot_workflows__pb2.CancelTasksRequest.SerializeToString,
                response_deserializer=v1_dot_workflows__pb2.CancelTasksResponse.FromString,
                _registered_method=True)
        self.ReplayTasks = channel.unary_unary(
                '/v1.AdminService/ReplayTasks',
                request_serializer=v1_dot_workflows__pb2.ReplayTasksRequest.SerializeToString,
                response_deserializer=v1_dot_workflows__pb2.ReplayTasksResponse.FromString,
                _registered_method=True)
        self.TriggerWorkflowRun = channel.unary_unary(
                '/v1.AdminService/TriggerWorkflowRun',
                request_serializer=v1_dot_workflows__pb2.TriggerWorkflowRunRequest.SerializeToString,
                response_deserializer=v1_dot_workflows__pb2.TriggerWorkflowRunResponse.FromString,
                _registered_method=True)
        self.GetRunDetails = channel.unary_unary(
                '/v1.AdminService/GetRunDetails',
                request_serializer=v1_dot_workflows__pb2.GetRunDetailsRequest.SerializeToString,
                response_deserializer=v1_dot_workflows__pb2.GetRunDetailsResponse.FromString,
                _registered_method=True)


class AdminServiceServicer(object):
    """AdminService represents a set of RPCs for admin management of tasks, workflows, etc.
    """

    def PutWorkflow(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 CancelTasks(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 ReplayTasks(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 TriggerWorkflowRun(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 GetRunDetails(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_AdminServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'PutWorkflow': grpc.unary_unary_rpc_method_handler(
                    servicer.PutWorkflow,
                    request_deserializer=v1_dot_workflows__pb2.CreateWorkflowVersionRequest.FromString,
                    response_serializer=v1_dot_workflows__pb2.CreateWorkflowVersionResponse.SerializeToString,
            ),
            'CancelTasks': grpc.unary_unary_rpc_method_handler(
                    servicer.CancelTasks,
                    request_deserializer=v1_dot_workflows__pb2.CancelTasksRequest.FromString,
                    response_serializer=v1_dot_workflows__pb2.CancelTasksResponse.SerializeToString,
            ),
            'ReplayTasks': grpc.unary_unary_rpc_method_handler(
                    servicer.ReplayTasks,
                    request_deserializer=v1_dot_workflows__pb2.ReplayTasksRequest.FromString,
                    response_serializer=v1_dot_workflows__pb2.ReplayTasksResponse.SerializeToString,
            ),
            'TriggerWorkflowRun': grpc.unary_unary_rpc_method_handler(
                    servicer.TriggerWorkflowRun,
                    request_deserializer=v1_dot_workflows__pb2.TriggerWorkflowRunRequest.FromString,
                    response_serializer=v1_dot_workflows__pb2.TriggerWorkflowRunResponse.SerializeToString,
            ),
            'GetRunDetails': grpc.unary_unary_rpc_method_handler(
                    servicer.GetRunDetails,
                    request_deserializer=v1_dot_workflows__pb2.GetRunDetailsRequest.FromString,
                    response_serializer=v1_dot_workflows__pb2.GetRunDetailsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'v1.AdminService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('v1.AdminService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class AdminService(object):
    """AdminService represents a set of RPCs for admin management of tasks, workflows, etc.
    """

    @staticmethod
    def PutWorkflow(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,
            '/v1.AdminService/PutWorkflow',
            v1_dot_workflows__pb2.CreateWorkflowVersionRequest.SerializeToString,
            v1_dot_workflows__pb2.CreateWorkflowVersionResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def CancelTasks(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,
            '/v1.AdminService/CancelTasks',
            v1_dot_workflows__pb2.CancelTasksRequest.SerializeToString,
            v1_dot_workflows__pb2.CancelTasksResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ReplayTasks(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,
            '/v1.AdminService/ReplayTasks',
            v1_dot_workflows__pb2.ReplayTasksRequest.SerializeToString,
            v1_dot_workflows__pb2.ReplayTasksResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def TriggerWorkflowRun(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,
            '/v1.AdminService/TriggerWorkflowRun',
            v1_dot_workflows__pb2.TriggerWorkflowRunRequest.SerializeToString,
            v1_dot_workflows__pb2.TriggerWorkflowRunResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetRunDetails(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,
            '/v1.AdminService/GetRunDetails',
            v1_dot_workflows__pb2.GetRunDetailsRequest.SerializeToString,
            v1_dot_workflows__pb2.GetRunDetailsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
