# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from cogment.api import agent_pb2 as cogment_dot_api_dot_agent__pb2
from cogment.api import common_pb2 as cogment_dot_api_dot_common__pb2


class AgentEndpointStub(object):
    """This is the connection between a model application and the orchestrator.
    The service is hosted on the model.
    Expected metadata for all calls except `Version`:
    - trial-id: The id of the trial
    - actor-name: The name of the actor within the trial
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.OnStart = channel.unary_unary(
                '/cogment.AgentEndpoint/OnStart',
                request_serializer=cogment_dot_api_dot_agent__pb2.AgentStartRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_agent__pb2.AgentStartReply.FromString,
                )
        self.OnObservation = channel.stream_stream(
                '/cogment.AgentEndpoint/OnObservation',
                request_serializer=cogment_dot_api_dot_agent__pb2.AgentObservationRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_agent__pb2.AgentActionReply.FromString,
                )
        self.OnReward = channel.unary_unary(
                '/cogment.AgentEndpoint/OnReward',
                request_serializer=cogment_dot_api_dot_agent__pb2.AgentRewardRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_agent__pb2.AgentRewardReply.FromString,
                )
        self.OnMessage = channel.unary_unary(
                '/cogment.AgentEndpoint/OnMessage',
                request_serializer=cogment_dot_api_dot_agent__pb2.AgentMessageRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_agent__pb2.AgentMessageReply.FromString,
                )
        self.OnEnd = channel.unary_unary(
                '/cogment.AgentEndpoint/OnEnd',
                request_serializer=cogment_dot_api_dot_agent__pb2.AgentEndRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_agent__pb2.AgentEndReply.FromString,
                )
        self.Version = channel.unary_unary(
                '/cogment.AgentEndpoint/Version',
                request_serializer=cogment_dot_api_dot_common__pb2.VersionRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_common__pb2.VersionInfo.FromString,
                )


class AgentEndpointServicer(object):
    """This is the connection between a model application and the orchestrator.
    The service is hosted on the model.
    Expected metadata for all calls except `Version`:
    - trial-id: The id of the trial
    - actor-name: The name of the actor within the trial
    """

    def OnStart(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 OnObservation(self, request_iterator, 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 OnReward(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 OnMessage(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 OnEnd(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 Version(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_AgentEndpointServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'OnStart': grpc.unary_unary_rpc_method_handler(
                    servicer.OnStart,
                    request_deserializer=cogment_dot_api_dot_agent__pb2.AgentStartRequest.FromString,
                    response_serializer=cogment_dot_api_dot_agent__pb2.AgentStartReply.SerializeToString,
            ),
            'OnObservation': grpc.stream_stream_rpc_method_handler(
                    servicer.OnObservation,
                    request_deserializer=cogment_dot_api_dot_agent__pb2.AgentObservationRequest.FromString,
                    response_serializer=cogment_dot_api_dot_agent__pb2.AgentActionReply.SerializeToString,
            ),
            'OnReward': grpc.unary_unary_rpc_method_handler(
                    servicer.OnReward,
                    request_deserializer=cogment_dot_api_dot_agent__pb2.AgentRewardRequest.FromString,
                    response_serializer=cogment_dot_api_dot_agent__pb2.AgentRewardReply.SerializeToString,
            ),
            'OnMessage': grpc.unary_unary_rpc_method_handler(
                    servicer.OnMessage,
                    request_deserializer=cogment_dot_api_dot_agent__pb2.AgentMessageRequest.FromString,
                    response_serializer=cogment_dot_api_dot_agent__pb2.AgentMessageReply.SerializeToString,
            ),
            'OnEnd': grpc.unary_unary_rpc_method_handler(
                    servicer.OnEnd,
                    request_deserializer=cogment_dot_api_dot_agent__pb2.AgentEndRequest.FromString,
                    response_serializer=cogment_dot_api_dot_agent__pb2.AgentEndReply.SerializeToString,
            ),
            'Version': grpc.unary_unary_rpc_method_handler(
                    servicer.Version,
                    request_deserializer=cogment_dot_api_dot_common__pb2.VersionRequest.FromString,
                    response_serializer=cogment_dot_api_dot_common__pb2.VersionInfo.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'cogment.AgentEndpoint', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class AgentEndpoint(object):
    """This is the connection between a model application and the orchestrator.
    The service is hosted on the model.
    Expected metadata for all calls except `Version`:
    - trial-id: The id of the trial
    - actor-name: The name of the actor within the trial
    """

    @staticmethod
    def OnStart(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, '/cogment.AgentEndpoint/OnStart',
            cogment_dot_api_dot_agent__pb2.AgentStartRequest.SerializeToString,
            cogment_dot_api_dot_agent__pb2.AgentStartReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def OnObservation(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, '/cogment.AgentEndpoint/OnObservation',
            cogment_dot_api_dot_agent__pb2.AgentObservationRequest.SerializeToString,
            cogment_dot_api_dot_agent__pb2.AgentActionReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def OnReward(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, '/cogment.AgentEndpoint/OnReward',
            cogment_dot_api_dot_agent__pb2.AgentRewardRequest.SerializeToString,
            cogment_dot_api_dot_agent__pb2.AgentRewardReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def OnMessage(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, '/cogment.AgentEndpoint/OnMessage',
            cogment_dot_api_dot_agent__pb2.AgentMessageRequest.SerializeToString,
            cogment_dot_api_dot_agent__pb2.AgentMessageReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def OnEnd(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, '/cogment.AgentEndpoint/OnEnd',
            cogment_dot_api_dot_agent__pb2.AgentEndRequest.SerializeToString,
            cogment_dot_api_dot_agent__pb2.AgentEndReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Version(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, '/cogment.AgentEndpoint/Version',
            cogment_dot_api_dot_common__pb2.VersionRequest.SerializeToString,
            cogment_dot_api_dot_common__pb2.VersionInfo.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
