# 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 . import agent_pb2 as agent__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 agent_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 AgentServiceStub(object):
    """Per-agent RL-style observation streaming (training / inference clients consume this).
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.GetAgentSchema = channel.unary_unary(
                '/hazel.rpc.AgentService/GetAgentSchema',
                request_serializer=agent__pb2.GetAgentSchemaRequest.SerializeToString,
                response_deserializer=agent__pb2.GetAgentSchemaResponse.FromString,
                _registered_method=True)
        self.GetObservation = channel.unary_unary(
                '/hazel.rpc.AgentService/GetObservation',
                request_serializer=agent__pb2.GetObservationRequest.SerializeToString,
                response_deserializer=agent__pb2.GetObservationResponse.FromString,
                _registered_method=True)
        self.StreamAgent = channel.unary_stream(
                '/hazel.rpc.AgentService/StreamAgent',
                request_serializer=agent__pb2.StreamAgentRequest.SerializeToString,
                response_deserializer=agent__pb2.AgentFrame.FromString,
                _registered_method=True)
        self.ResetAgent = channel.unary_unary(
                '/hazel.rpc.AgentService/ResetAgent',
                request_serializer=agent__pb2.ResetAgentRequest.SerializeToString,
                response_deserializer=agent__pb2.ResetAgentResponse.FromString,
                _registered_method=True)
        self.Step = channel.unary_unary(
                '/hazel.rpc.AgentService/Step',
                request_serializer=agent__pb2.StepRequest.SerializeToString,
                response_deserializer=agent__pb2.StepResponse.FromString,
                _registered_method=True)


class AgentServiceServicer(object):
    """Per-agent RL-style observation streaming (training / inference clients consume this).
    """

    def GetAgentSchema(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 GetObservation(self, request, context):
        """Single-shot observation snapshot (unified observation surface).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def StreamAgent(self, request, context):
        """Server-streaming observations (and optional action echo) for a single agent.

        The client specifies which agent to stream via StreamAgentRequest and may
        provide a target FPS hint. Actions are currently sent via MujocoService
        (SendControl); AgentFrame.actions is primarily used for telemetry.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ResetAgent(self, request, context):
        """Reset a specific agent (full reset: clear buffers, reset state, resample commands, apply MuJoCo state).
        Useful for multi-env RL where individual agents need to be reset without resetting the entire scene.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Step(self, request, context):
        """Synchronous RL step: apply action, wait for physics, return observation.
        This is the recommended interface for RL training as it eliminates
        one network round-trip compared to separate SendControl + GetObservation.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_AgentServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetAgentSchema': grpc.unary_unary_rpc_method_handler(
                    servicer.GetAgentSchema,
                    request_deserializer=agent__pb2.GetAgentSchemaRequest.FromString,
                    response_serializer=agent__pb2.GetAgentSchemaResponse.SerializeToString,
            ),
            'GetObservation': grpc.unary_unary_rpc_method_handler(
                    servicer.GetObservation,
                    request_deserializer=agent__pb2.GetObservationRequest.FromString,
                    response_serializer=agent__pb2.GetObservationResponse.SerializeToString,
            ),
            'StreamAgent': grpc.unary_stream_rpc_method_handler(
                    servicer.StreamAgent,
                    request_deserializer=agent__pb2.StreamAgentRequest.FromString,
                    response_serializer=agent__pb2.AgentFrame.SerializeToString,
            ),
            'ResetAgent': grpc.unary_unary_rpc_method_handler(
                    servicer.ResetAgent,
                    request_deserializer=agent__pb2.ResetAgentRequest.FromString,
                    response_serializer=agent__pb2.ResetAgentResponse.SerializeToString,
            ),
            'Step': grpc.unary_unary_rpc_method_handler(
                    servicer.Step,
                    request_deserializer=agent__pb2.StepRequest.FromString,
                    response_serializer=agent__pb2.StepResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'hazel.rpc.AgentService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('hazel.rpc.AgentService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class AgentService(object):
    """Per-agent RL-style observation streaming (training / inference clients consume this).
    """

    @staticmethod
    def GetAgentSchema(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,
            '/hazel.rpc.AgentService/GetAgentSchema',
            agent__pb2.GetAgentSchemaRequest.SerializeToString,
            agent__pb2.GetAgentSchemaResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetObservation(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,
            '/hazel.rpc.AgentService/GetObservation',
            agent__pb2.GetObservationRequest.SerializeToString,
            agent__pb2.GetObservationResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StreamAgent(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_stream(
            request,
            target,
            '/hazel.rpc.AgentService/StreamAgent',
            agent__pb2.StreamAgentRequest.SerializeToString,
            agent__pb2.AgentFrame.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ResetAgent(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,
            '/hazel.rpc.AgentService/ResetAgent',
            agent__pb2.ResetAgentRequest.SerializeToString,
            agent__pb2.ResetAgentResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Step(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,
            '/hazel.rpc.AgentService/Step',
            agent__pb2.StepRequest.SerializeToString,
            agent__pb2.StepResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
