# SPDX-FileCopyrightText: 2025 CoreWeave, Inc.
# SPDX-License-Identifier: Apache-2.0
# SPDX-PackageName: cwsandbox-client
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from cwsandbox._proto import streaming_pb2 as coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2


class ATCStreamingServiceStub(object):
    """ATCStreamingService provides real-time streaming capabilities for sandboxes.
    This service uses bidirectional streaming for full-duplex communication.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.StreamExec = channel.stream_stream(
                '/coreweave.aviato.v1beta1.ATCStreamingService/StreamExec',
                request_serializer=coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.ExecStreamRequest.SerializeToString,
                response_deserializer=coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.ExecStreamResponse.FromString,
                _registered_method=True)
        self.StreamLogs = channel.stream_stream(
                '/coreweave.aviato.v1beta1.ATCStreamingService/StreamLogs',
                request_serializer=coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.LogStreamRequest.SerializeToString,
                response_deserializer=coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.LogStreamResponse.FromString,
                _registered_method=True)


class ATCStreamingServiceServicer(object):
    """ATCStreamingService provides real-time streaming capabilities for sandboxes.
    This service uses bidirectional streaming for full-duplex communication.
    """

    def StreamExec(self, request_iterator, context):
        """StreamExec executes a command with real-time stdin/stdout/stderr streaming.
        The client sends ExecStreamRequest messages (init, stdin, resize, close).
        The server sends ExecStreamResponse messages (output, exit, error).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def StreamLogs(self, request_iterator, context):
        """StreamLogs tails logs from a sandbox in real-time.
        The client sends LogStreamRequest messages (init, close).
        The server sends LogStreamResponse messages (data, error, complete).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ATCStreamingServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'StreamExec': grpc.stream_stream_rpc_method_handler(
                    servicer.StreamExec,
                    request_deserializer=coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.ExecStreamRequest.FromString,
                    response_serializer=coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.ExecStreamResponse.SerializeToString,
            ),
            'StreamLogs': grpc.stream_stream_rpc_method_handler(
                    servicer.StreamLogs,
                    request_deserializer=coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.LogStreamRequest.FromString,
                    response_serializer=coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.LogStreamResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'coreweave.aviato.v1beta1.ATCStreamingService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('coreweave.aviato.v1beta1.ATCStreamingService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class ATCStreamingService(object):
    """ATCStreamingService provides real-time streaming capabilities for sandboxes.
    This service uses bidirectional streaming for full-duplex communication.
    """

    @staticmethod
    def StreamExec(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(
            request_iterator,
            target,
            '/coreweave.aviato.v1beta1.ATCStreamingService/StreamExec',
            coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.ExecStreamRequest.SerializeToString,
            coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.ExecStreamResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StreamLogs(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(
            request_iterator,
            target,
            '/coreweave.aviato.v1beta1.ATCStreamingService/StreamLogs',
            coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.LogStreamRequest.SerializeToString,
            coreweave_dot_aviato_dot_v1beta1_dot_streaming__pb2.LogStreamResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
