# 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 common_pb2 as cogment_dot_api_dot_common__pb2
from cogment.api import orchestrator_pb2 as cogment_dot_api_dot_orchestrator__pb2


class TrialLifecycleStub(object):
    """This service is used to manage Trial lifecycle.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.StartTrial = channel.unary_unary(
                '/cogment.TrialLifecycle/StartTrial',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialStartRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialStartReply.FromString,
                )
        self.TerminateTrial = channel.unary_unary(
                '/cogment.TrialLifecycle/TerminateTrial',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TerminateTrialRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TerminateTrialReply.FromString,
                )
        self.GetTrialInfo = channel.unary_unary(
                '/cogment.TrialLifecycle/GetTrialInfo',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialInfoRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialInfoReply.FromString,
                )
        self.WatchTrials = channel.unary_stream(
                '/cogment.TrialLifecycle/WatchTrials',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialListRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialListEntry.FromString,
                )
        self.Version = channel.unary_unary(
                '/cogment.TrialLifecycle/Version',
                request_serializer=cogment_dot_api_dot_common__pb2.VersionRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_common__pb2.VersionInfo.FromString,
                )


class TrialLifecycleServicer(object):
    """This service is used to manage Trial lifecycle.
    """

    def StartTrial(self, request, context):
        """Begin a new trial.
        Expected headers: None
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def TerminateTrial(self, request, context):
        """Terminate an existing trial.
        Expected headers: 
        - trial-id
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetTrialInfo(self, request, context):
        """Get extra information about a specific trial.
        Expected headers: 
        - trial-id <optional>
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def WatchTrials(self, request, context):
        """Get information about the trials currently running in the orchestrator.
        The stream will be prefixed by all the currently filtered existing trials,
        and will return a new message whenever a trial enters a filtered state.
        Expected headers: None
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Version(self, request, context):
        """Expected headers: None
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_TrialLifecycleServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'StartTrial': grpc.unary_unary_rpc_method_handler(
                    servicer.StartTrial,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialStartRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialStartReply.SerializeToString,
            ),
            'TerminateTrial': grpc.unary_unary_rpc_method_handler(
                    servicer.TerminateTrial,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TerminateTrialRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TerminateTrialReply.SerializeToString,
            ),
            'GetTrialInfo': grpc.unary_unary_rpc_method_handler(
                    servicer.GetTrialInfo,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialInfoRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialInfoReply.SerializeToString,
            ),
            'WatchTrials': grpc.unary_stream_rpc_method_handler(
                    servicer.WatchTrials,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialListRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialListEntry.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.TrialLifecycle', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class TrialLifecycle(object):
    """This service is used to manage Trial lifecycle.
    """

    @staticmethod
    def StartTrial(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.TrialLifecycle/StartTrial',
            cogment_dot_api_dot_orchestrator__pb2.TrialStartRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TrialStartReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def TerminateTrial(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.TrialLifecycle/TerminateTrial',
            cogment_dot_api_dot_orchestrator__pb2.TerminateTrialRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TerminateTrialReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetTrialInfo(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.TrialLifecycle/GetTrialInfo',
            cogment_dot_api_dot_orchestrator__pb2.TrialInfoRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TrialInfoReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def WatchTrials(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, '/cogment.TrialLifecycle/WatchTrials',
            cogment_dot_api_dot_orchestrator__pb2.TrialListRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TrialListEntry.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.TrialLifecycle/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)


class ClientActorStub(object):
    """This service is used by an actor within a trial, using the "client" API.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.JoinTrial = channel.unary_unary(
                '/cogment.ClientActor/JoinTrial',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialJoinRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialJoinReply.FromString,
                )
        self.ActionStream = channel.stream_stream(
                '/cogment.ClientActor/ActionStream',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialActionRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialActionReply.FromString,
                )
        self.Heartbeat = channel.unary_unary(
                '/cogment.ClientActor/Heartbeat',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialHeartbeatRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialHeartbeatReply.FromString,
                )
        self.SendReward = channel.unary_unary(
                '/cogment.ClientActor/SendReward',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialRewardRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialRewardReply.FromString,
                )
        self.SendMessage = channel.unary_unary(
                '/cogment.ClientActor/SendMessage',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialMessageRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialMessageReply.FromString,
                )
        self.Version = channel.unary_unary(
                '/cogment.ClientActor/Version',
                request_serializer=cogment_dot_api_dot_common__pb2.VersionRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_common__pb2.VersionInfo.FromString,
                )


class ClientActorServicer(object):
    """This service is used by an actor within a trial, using the "client" API.
    """

    def JoinTrial(self, request, context):
        """Expected headers: None
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ActionStream(self, request_iterator, context):
        """Expected headers: 
        - trial-id
        - actor-name
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Heartbeat(self, request, context):
        """Expected headers: 
        - trial-id
        - actor-name
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SendReward(self, request, context):
        """Expected headers: 
        - trial-id
        - actor-name
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SendMessage(self, request, context):
        """Expected headers: 
        - trial-id
        - actor-name
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Version(self, request, context):
        """Expected headers: None
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ClientActorServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'JoinTrial': grpc.unary_unary_rpc_method_handler(
                    servicer.JoinTrial,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialJoinRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialJoinReply.SerializeToString,
            ),
            'ActionStream': grpc.stream_stream_rpc_method_handler(
                    servicer.ActionStream,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialActionRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialActionReply.SerializeToString,
            ),
            'Heartbeat': grpc.unary_unary_rpc_method_handler(
                    servicer.Heartbeat,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialHeartbeatRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialHeartbeatReply.SerializeToString,
            ),
            'SendReward': grpc.unary_unary_rpc_method_handler(
                    servicer.SendReward,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialRewardRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialRewardReply.SerializeToString,
            ),
            'SendMessage': grpc.unary_unary_rpc_method_handler(
                    servicer.SendMessage,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialMessageRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialMessageReply.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.ClientActor', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class ClientActor(object):
    """This service is used by an actor within a trial, using the "client" API.
    """

    @staticmethod
    def JoinTrial(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.ClientActor/JoinTrial',
            cogment_dot_api_dot_orchestrator__pb2.TrialJoinRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TrialJoinReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def ActionStream(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.ClientActor/ActionStream',
            cogment_dot_api_dot_orchestrator__pb2.TrialActionRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TrialActionReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Heartbeat(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.ClientActor/Heartbeat',
            cogment_dot_api_dot_orchestrator__pb2.TrialHeartbeatRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TrialHeartbeatReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def SendReward(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.ClientActor/SendReward',
            cogment_dot_api_dot_orchestrator__pb2.TrialRewardRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TrialRewardReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def SendMessage(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.ClientActor/SendMessage',
            cogment_dot_api_dot_orchestrator__pb2.TrialMessageRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TrialMessageReply.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.ClientActor/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)
