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

from chia_tea.protobuf.generated import computer_info_pb2 as chia__tea_dot_protobuf_dot_generated_dot_computer__info__pb2
from chia_tea.protobuf.generated import monitoring_service_pb2 as chia__tea_dot_protobuf_dot_generated_dot_monitoring__service__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2


class MonitoringStub(object):
    """Monitoring service description with methods
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.GetMachineState = channel.unary_unary(
                '/chia_tea.protobuf.generated.monitoring_service_pb2.Monitoring/GetMachineState',
                request_serializer=chia__tea_dot_protobuf_dot_generated_dot_monitoring__service__pb2.GetStateRequest.SerializeToString,
                response_deserializer=chia__tea_dot_protobuf_dot_generated_dot_computer__info__pb2.ComputerInfo.FromString,
                )
        self.SendMonitoringUpdate = channel.stream_stream(
                '/chia_tea.protobuf.generated.monitoring_service_pb2.Monitoring/SendMonitoringUpdate',
                request_serializer=chia__tea_dot_protobuf_dot_generated_dot_monitoring__service__pb2.DataUpdateRequest.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                )


class MonitoringServicer(object):
    """Monitoring service description with methods
    """

    def GetMachineState(self, request, context):
        """This method allows to poll the current or last known state of a machine in the form of
        a ComputerInfo. This is done after establishing a connection by every client so that 
        the clients can compute the correct updates for the database to this last known state. 
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SendMonitoringUpdate(self, request_iterator, context):
        """SendMonitoringUpdate allows the client to send an endless stream of data update requests
        which contain UpdateEvents to be stored in the database. The server can send empty messages
        to probe the connection status if desired (not implemented at the moment).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_MonitoringServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetMachineState': grpc.unary_unary_rpc_method_handler(
                    servicer.GetMachineState,
                    request_deserializer=chia__tea_dot_protobuf_dot_generated_dot_monitoring__service__pb2.GetStateRequest.FromString,
                    response_serializer=chia__tea_dot_protobuf_dot_generated_dot_computer__info__pb2.ComputerInfo.SerializeToString,
            ),
            'SendMonitoringUpdate': grpc.stream_stream_rpc_method_handler(
                    servicer.SendMonitoringUpdate,
                    request_deserializer=chia__tea_dot_protobuf_dot_generated_dot_monitoring__service__pb2.DataUpdateRequest.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'chia_tea.protobuf.generated.monitoring_service_pb2.Monitoring', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class Monitoring(object):
    """Monitoring service description with methods
    """

    @staticmethod
    def GetMachineState(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, '/chia_tea.protobuf.generated.monitoring_service_pb2.Monitoring/GetMachineState',
            chia__tea_dot_protobuf_dot_generated_dot_monitoring__service__pb2.GetStateRequest.SerializeToString,
            chia__tea_dot_protobuf_dot_generated_dot_computer__info__pb2.ComputerInfo.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def SendMonitoringUpdate(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, '/chia_tea.protobuf.generated.monitoring_service_pb2.Monitoring/SendMonitoringUpdate',
            chia__tea_dot_protobuf_dot_generated_dot_monitoring__service__pb2.DataUpdateRequest.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
