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

from . import gateway_pb2 as gateway__pb2


class ForecastsStub(object):
    """Forecasts streams a series of Forecast messages, containing stock price movements
    Anglo Korean have forecasted from a series of sources.

    Each new stream request is Authenticated and Authorized with a token. This is used
    to first ensure a client even has access to forecasts, and then (internally) to
    ensure a client receives the forecasts they've been granted access to.

    Further, tokens are revalidated every 30m. This is done to ensure that upgrades/
    downgrades are actioned properly. Clients are advised that restarting connections
    will also revalidate connections (so: after upgrading a token, a client may not
    need to wait for 30m).
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Stream = channel.unary_stream(
                '/Forecasts/Stream',
                request_serializer=gateway__pb2.Metadata.SerializeToString,
                response_deserializer=gateway__pb2.Forecast.FromString,
                )


class ForecastsServicer(object):
    """Forecasts streams a series of Forecast messages, containing stock price movements
    Anglo Korean have forecasted from a series of sources.

    Each new stream request is Authenticated and Authorized with a token. This is used
    to first ensure a client even has access to forecasts, and then (internally) to
    ensure a client receives the forecasts they've been granted access to.

    Further, tokens are revalidated every 30m. This is done to ensure that upgrades/
    downgrades are actioned properly. Clients are advised that restarting connections
    will also revalidate connections (so: after upgrading a token, a client may not
    need to wait for 30m).
    """

    def Stream(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_ForecastsServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Stream': grpc.unary_stream_rpc_method_handler(
                    servicer.Stream,
                    request_deserializer=gateway__pb2.Metadata.FromString,
                    response_serializer=gateway__pb2.Forecast.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'Forecasts', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class Forecasts(object):
    """Forecasts streams a series of Forecast messages, containing stock price movements
    Anglo Korean have forecasted from a series of sources.

    Each new stream request is Authenticated and Authorized with a token. This is used
    to first ensure a client even has access to forecasts, and then (internally) to
    ensure a client receives the forecasts they've been granted access to.

    Further, tokens are revalidated every 30m. This is done to ensure that upgrades/
    downgrades are actioned properly. Clients are advised that restarting connections
    will also revalidate connections (so: after upgrading a token, a client may not
    need to wait for 30m).
    """

    @staticmethod
    def Stream(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, '/Forecasts/Stream',
            gateway__pb2.Metadata.SerializeToString,
            gateway__pb2.Forecast.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
