"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
Copyright 2025 Redpanda Data, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import abc
import collections.abc
import grpc
import grpc.aio
from .... import redpanda
import typing
_T = typing.TypeVar('_T')

class _MaybeAsyncIterator(collections.abc.AsyncIterator[_T], collections.abc.Iterator[_T], metaclass=abc.ABCMeta):
    ...

class _ServicerContext(grpc.ServicerContext, grpc.aio.ServicerContext):
    ...

class BatchOutputServiceStub:
    """BatchOutput is an interface implemented by Benthos outputs that require
    Benthos to batch messages before dispatch in order to improve throughput.
    Each call to WriteBatch should block until either all messages in the batch
    have been successfully or unsuccessfully sent, or the RPC deadline is reached.

    Multiple write calls can be performed in parallel, and the constructor of an
    output must provide a MaxInFlight parameter indicating the maximum number of
    parallel batched write calls the output supports.
    """

    def __init__(self, channel: typing.Union[grpc.Channel, grpc.aio.Channel]) -> None:
        ...
    Init: grpc.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputInitRequest, redpanda.runtime.v1alpha1.output_pb2.BatchOutputInitResponse]
    "Init is the first method called for a batch output and it passes the user's\n    configuration to the output.\n\n    The schema for the output configuration is specified in the `plugin.yaml`\n    file provided to Redpanda Connect.\n    "
    Connect: grpc.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputConnectRequest, redpanda.runtime.v1alpha1.output_pb2.BatchOutputConnectResponse]
    'Establish a connection to the downstream service. Connect will always be\n    called first when a writer is instantiated, and will be continuously\n    called with back off until a nil error is returned.\n\n    Once Connect returns a nil error the write method will be called until\n    either Error.NotConnected is returned, or the writer is closed.\n    '
    Send: grpc.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputSendRequest, redpanda.runtime.v1alpha1.output_pb2.BatchOutputSendResponse]
    'Write a batch of messages to a sink, or return an error if delivery is\n    not possible.\n\n    If this method returns Error.NotConnected then write will not be called\n    again until Connect has returned a nil error.\n    '
    Close: grpc.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputCloseRequest, redpanda.runtime.v1alpha1.output_pb2.BatchOutputCloseResponse]
    'Close the component, blocks until either the underlying resources are\n    cleaned up or the RPC deadline is reached.\n    '

class BatchOutputServiceAsyncStub:
    """BatchOutput is an interface implemented by Benthos outputs that require
    Benthos to batch messages before dispatch in order to improve throughput.
    Each call to WriteBatch should block until either all messages in the batch
    have been successfully or unsuccessfully sent, or the RPC deadline is reached.

    Multiple write calls can be performed in parallel, and the constructor of an
    output must provide a MaxInFlight parameter indicating the maximum number of
    parallel batched write calls the output supports.
    """
    Init: grpc.aio.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputInitRequest, redpanda.runtime.v1alpha1.output_pb2.BatchOutputInitResponse]
    "Init is the first method called for a batch output and it passes the user's\n    configuration to the output.\n\n    The schema for the output configuration is specified in the `plugin.yaml`\n    file provided to Redpanda Connect.\n    "
    Connect: grpc.aio.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputConnectRequest, redpanda.runtime.v1alpha1.output_pb2.BatchOutputConnectResponse]
    'Establish a connection to the downstream service. Connect will always be\n    called first when a writer is instantiated, and will be continuously\n    called with back off until a nil error is returned.\n\n    Once Connect returns a nil error the write method will be called until\n    either Error.NotConnected is returned, or the writer is closed.\n    '
    Send: grpc.aio.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputSendRequest, redpanda.runtime.v1alpha1.output_pb2.BatchOutputSendResponse]
    'Write a batch of messages to a sink, or return an error if delivery is\n    not possible.\n\n    If this method returns Error.NotConnected then write will not be called\n    again until Connect has returned a nil error.\n    '
    Close: grpc.aio.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputCloseRequest, redpanda.runtime.v1alpha1.output_pb2.BatchOutputCloseResponse]
    'Close the component, blocks until either the underlying resources are\n    cleaned up or the RPC deadline is reached.\n    '

class BatchOutputServiceServicer(metaclass=abc.ABCMeta):
    """BatchOutput is an interface implemented by Benthos outputs that require
    Benthos to batch messages before dispatch in order to improve throughput.
    Each call to WriteBatch should block until either all messages in the batch
    have been successfully or unsuccessfully sent, or the RPC deadline is reached.

    Multiple write calls can be performed in parallel, and the constructor of an
    output must provide a MaxInFlight parameter indicating the maximum number of
    parallel batched write calls the output supports.
    """

    @abc.abstractmethod
    def Init(self, request: redpanda.runtime.v1alpha1.output_pb2.BatchOutputInitRequest, context: _ServicerContext) -> typing.Union[redpanda.runtime.v1alpha1.output_pb2.BatchOutputInitResponse, collections.abc.Awaitable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputInitResponse]]:
        """Init is the first method called for a batch output and it passes the user's
        configuration to the output.

        The schema for the output configuration is specified in the `plugin.yaml`
        file provided to Redpanda Connect.
        """

    @abc.abstractmethod
    def Connect(self, request: redpanda.runtime.v1alpha1.output_pb2.BatchOutputConnectRequest, context: _ServicerContext) -> typing.Union[redpanda.runtime.v1alpha1.output_pb2.BatchOutputConnectResponse, collections.abc.Awaitable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputConnectResponse]]:
        """Establish a connection to the downstream service. Connect will always be
        called first when a writer is instantiated, and will be continuously
        called with back off until a nil error is returned.

        Once Connect returns a nil error the write method will be called until
        either Error.NotConnected is returned, or the writer is closed.
        """

    @abc.abstractmethod
    def Send(self, request: redpanda.runtime.v1alpha1.output_pb2.BatchOutputSendRequest, context: _ServicerContext) -> typing.Union[redpanda.runtime.v1alpha1.output_pb2.BatchOutputSendResponse, collections.abc.Awaitable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputSendResponse]]:
        """Write a batch of messages to a sink, or return an error if delivery is
        not possible.

        If this method returns Error.NotConnected then write will not be called
        again until Connect has returned a nil error.
        """

    @abc.abstractmethod
    def Close(self, request: redpanda.runtime.v1alpha1.output_pb2.BatchOutputCloseRequest, context: _ServicerContext) -> typing.Union[redpanda.runtime.v1alpha1.output_pb2.BatchOutputCloseResponse, collections.abc.Awaitable[redpanda.runtime.v1alpha1.output_pb2.BatchOutputCloseResponse]]:
        """Close the component, blocks until either the underlying resources are
        cleaned up or the RPC deadline is reached.
        """

def add_BatchOutputServiceServicer_to_server(servicer: BatchOutputServiceServicer, server: typing.Union[grpc.Server, grpc.aio.Server]) -> None:
    ...