"""
@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 BatchProcessorServiceStub:
    """BatchProcessor is a Benthos processor implementation that works against
    batches of messages, which allows windowed processing.

    Message batches must be created by upstream components (inputs, buffers, etc)
    otherwise this processor will simply receive batches containing single
    messages.
    """

    def __init__(self, channel: typing.Union[grpc.Channel, grpc.aio.Channel]) -> None:
        ...
    Init: grpc.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorInitRequest, redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorInitResponse]
    "Init is the first method called for a batch processor and it passes the\n    user's configuration to the input.\n\n    The schema for the processor configuration is specified in the\n    `plugin.yaml` file provided to Redpanda Connect.\n    "
    ProcessBatch: grpc.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorProcessBatchRequest, redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorProcessBatchResponse]
    'Process a batch of messages into one or more resulting batches, or return\n    an error if the entire batch could not be processed. If zero messages are\n    returned and the error is nil then all messages are filtered.\n\n    The provided MessageBatch should NOT be modified, in order to return a\n    mutated batch a copy of the slice should be created instead.\n\n    When an error is returned all of the input messages will continue down\n    the pipeline but will be marked with the error with *message.SetError,\n    and metrics and logs will be emitted.\n\n    In order to add errors to individual messages of the batch for downstream\n    handling use message.SetError(err) and return it in the resulting batch\n    with a nil error.\n\n    The Message types returned MUST be derived from the provided messages,\n    and CANNOT be custom instantiations of Message. In order to copy the\n    provided messages use the Copy method.\n    '
    Close: grpc.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorCloseRequest, redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorCloseResponse]
    'Close the component, blocks until either the underlying resources are\n    cleaned up or the RPC deadline is reached.\n    '

class BatchProcessorServiceAsyncStub:
    """BatchProcessor is a Benthos processor implementation that works against
    batches of messages, which allows windowed processing.

    Message batches must be created by upstream components (inputs, buffers, etc)
    otherwise this processor will simply receive batches containing single
    messages.
    """
    Init: grpc.aio.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorInitRequest, redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorInitResponse]
    "Init is the first method called for a batch processor and it passes the\n    user's configuration to the input.\n\n    The schema for the processor configuration is specified in the\n    `plugin.yaml` file provided to Redpanda Connect.\n    "
    ProcessBatch: grpc.aio.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorProcessBatchRequest, redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorProcessBatchResponse]
    'Process a batch of messages into one or more resulting batches, or return\n    an error if the entire batch could not be processed. If zero messages are\n    returned and the error is nil then all messages are filtered.\n\n    The provided MessageBatch should NOT be modified, in order to return a\n    mutated batch a copy of the slice should be created instead.\n\n    When an error is returned all of the input messages will continue down\n    the pipeline but will be marked with the error with *message.SetError,\n    and metrics and logs will be emitted.\n\n    In order to add errors to individual messages of the batch for downstream\n    handling use message.SetError(err) and return it in the resulting batch\n    with a nil error.\n\n    The Message types returned MUST be derived from the provided messages,\n    and CANNOT be custom instantiations of Message. In order to copy the\n    provided messages use the Copy method.\n    '
    Close: grpc.aio.UnaryUnaryMultiCallable[redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorCloseRequest, redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorCloseResponse]
    'Close the component, blocks until either the underlying resources are\n    cleaned up or the RPC deadline is reached.\n    '

class BatchProcessorServiceServicer(metaclass=abc.ABCMeta):
    """BatchProcessor is a Benthos processor implementation that works against
    batches of messages, which allows windowed processing.

    Message batches must be created by upstream components (inputs, buffers, etc)
    otherwise this processor will simply receive batches containing single
    messages.
    """

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

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

    @abc.abstractmethod
    def ProcessBatch(self, request: redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorProcessBatchRequest, context: _ServicerContext) -> typing.Union[redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorProcessBatchResponse, collections.abc.Awaitable[redpanda.runtime.v1alpha1.processor_pb2.BatchProcessorProcessBatchResponse]]:
        """Process a batch of messages into one or more resulting batches, or return
        an error if the entire batch could not be processed. If zero messages are
        returned and the error is nil then all messages are filtered.

        The provided MessageBatch should NOT be modified, in order to return a
        mutated batch a copy of the slice should be created instead.

        When an error is returned all of the input messages will continue down
        the pipeline but will be marked with the error with *message.SetError,
        and metrics and logs will be emitted.

        In order to add errors to individual messages of the batch for downstream
        handling use message.SetError(err) and return it in the resulting batch
        with a nil error.

        The Message types returned MUST be derived from the provided messages,
        and CANNOT be custom instantiations of Message. In order to copy the
        provided messages use the Copy method.
        """

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

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