# -*- coding: utf-8 -*-
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from stellarstation.api.v1 import stellarstation_pb2 as stellarstation_dot_api_dot_v1_dot_stellarstation__pb2


class StellarStationServiceStub(object):
  """The public API service of StellarStation, a system supporting communication between satellites
  and ground stations. This API is for use by an operator of a satellite - it is invalid to specify
  satellites that the operator does not own or plans they have not reserved.
  Only using IDs shown on the StellarStation Console or returned in API responses will ensure all
  inputs are valid.

  A pass is a time range where an ground station and satellite can communicate with each other, i.e.,
  the period between Acquisition of Signal (AOS) and Loss of Signal (LOS) of the ground station and
  satellite pair.

  A plan is a scheduled pass that will be executed to send and receive data between the ground
  station and satellite during the time range.
  """

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

    Args:
      channel: A grpc.Channel.
    """
    self.ListPlans = channel.unary_unary(
        '/stellarstation.api.v1.StellarStationService/ListPlans',
        request_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ListPlansRequest.SerializeToString,
        response_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ListPlansResponse.FromString,
        )
    self.CancelPlan = channel.unary_unary(
        '/stellarstation.api.v1.StellarStationService/CancelPlan',
        request_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.CancelPlanRequest.SerializeToString,
        response_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.CancelPlanResponse.FromString,
        )
    self.ListUpcomingAvailablePasses = channel.unary_unary(
        '/stellarstation.api.v1.StellarStationService/ListUpcomingAvailablePasses',
        request_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ListUpcomingAvailablePassesRequest.SerializeToString,
        response_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ListUpcomingAvailablePassesResponse.FromString,
        )
    self.OpenSatelliteStream = channel.stream_stream(
        '/stellarstation.api.v1.StellarStationService/OpenSatelliteStream',
        request_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.SatelliteStreamRequest.SerializeToString,
        response_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.SatelliteStreamResponse.FromString,
        )
    self.ReservePass = channel.unary_unary(
        '/stellarstation.api.v1.StellarStationService/ReservePass',
        request_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ReservePassRequest.SerializeToString,
        response_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ReservePassResponse.FromString,
        )
    self.AddTle = channel.unary_unary(
        '/stellarstation.api.v1.StellarStationService/AddTle',
        request_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.AddTleRequest.SerializeToString,
        response_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.AddTleResponse.FromString,
        )
    self.GetTle = channel.unary_unary(
        '/stellarstation.api.v1.StellarStationService/GetTle',
        request_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.GetTleRequest.SerializeToString,
        response_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.GetTleResponse.FromString,
        )


class StellarStationServiceServicer(object):
  """The public API service of StellarStation, a system supporting communication between satellites
  and ground stations. This API is for use by an operator of a satellite - it is invalid to specify
  satellites that the operator does not own or plans they have not reserved.
  Only using IDs shown on the StellarStation Console or returned in API responses will ensure all
  inputs are valid.

  A pass is a time range where an ground station and satellite can communicate with each other, i.e.,
  the period between Acquisition of Signal (AOS) and Loss of Signal (LOS) of the ground station and
  satellite pair.

  A plan is a scheduled pass that will be executed to send and receive data between the ground
  station and satellite during the time range.
  """

  def ListPlans(self, request, context):
    """Lists the plans for a particular satellite.

    The request will be closed with an `INVALID_ARGUMENT` status if `satellite_id`,
    `aos_after`, or `aos_before` are missing, or the duration between the two times is longer than
    31 days.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def CancelPlan(self, request, context):
    """Cancel a previously reserved upcoming plan. Cancelling the plan will cause it to not be
    executed. This action cannot be undone, but it is still possible to reserve the corresponding
    pass again by calling `ListUpcomingAvailablePasses` and `ReservePass` as usual - this will
    cause a new plan to be reserved. The plan cannot be cancelled less than ten minutes before
    AOS.

    Canceling a plan may incur a charge based on the time left to AOS. See our cancellation policy
    for details.

    If the plan is not found, the request will return a `NOT_FOUND` error.

    If the plan has already been canceled or is less than ten minutes away from its AOS, the
    request will return a `FAILED_PRECONDITION` error.

    If the plan is ongoing or has already finished executing, the request will return a
    `OUT_OF_RANGE` error.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def ListUpcomingAvailablePasses(self, request, context):
    """Lists upcoming passes for a satellite. Passes that can be scheduled for the satellite with an
    Acquisition of Signal (AOS) within 14 days from now will be returned. This method does not
    reserve passes in any way - it is possible for a pass that is returned by this method to be
    unschedulable when actually trying to schedule because a conflict appeared during that time.

    If the satellite is not found or the client is not authorized for it, the request will return
    a `NOT_FOUND` error.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def OpenSatelliteStream(self, request_iterator, context):
    """Open a stream to a satellite. The returned stream is bi-directional - it can be used by the
    client to send commands to the satellite and data received from the satellite will be returned
    as it is made available. All telemetry received from the satellite on reserved passes along
    with associated events from this point on will be returned as soon as this method is called. If
    `SatelliteStreamRequest.stream_id` is specified, any messages that have been buffered for the
    stream will be returned as well.

    The first `SatelliteStreamRequest` sent on the stream is used for configuring the stream.
    Unless otherwise specified, all configuration is taken from the first request and configuration
    values in subsequent requests will be ignored.

    The stream can be left open for any amount of time and telemetry will be received as available
    and returned. When the client is done with the stream, it should close it successfully. If the
    stream is cancelled with an unexpected error at any point, telemetry received before the next
    call to `OpenSatelliteStream` to resume the stream will be buffered up to 1 minute, and if no
    call to `OpenSatelliteStream` is made with `stream_id` specified to resume the stream, it will
    expire in 10 minutes and a call to `OpenSatelliteStream` with that `stream_id` will be closed
    with a `ABORTED` error.

    If the satellite is not found or the client is not authorized for it, the stream will be closed
    with a `NOT_FOUND` error.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def ReservePass(self, request, context):
    """Reserves a pass for later execution as a plan. The pass must be specified by a
    `reservation_token` returned in another method like `ListUpcomingAvailablePasses` and its
    `aos_time` must be at least one hour in the future.

    If the `reservation_token` is invalid, the request will return an `INVALID_ARGUMENT` error.

    If the requested pass cannot be scheduled due to a conflict with existing plans or other
    scheduling constraints, the request will return a `FAILED_PRECONDITION` error. This includes
    if the pass `aos_time` is less than one hour in the future.

    Note that the reservation_token may have become unreservable since it was fetched. If that's
    the case, the call to `ReservePass` will fail with a 'FAILED_PRECONDITION' error and
    `ListUpcomingAvailablePasses` should be called again to get a fresh list of reservable passes.
    The pass must be scheduled at least one hour in advance of `aos_time` or it will be rejected.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def AddTle(self, request, context):
    """Adds TLE for a satellite.

    The TLE will be used for satellite orbit calculation until it is superseded by a TLE with a
    more recent epoch. This happens automatically if StellarStation pulls new TLE data from
    external sources, or manually through this API etc.

    An 'INVALID_ARGUMENT' error will be returned in the following conditions:
    - the TLE cannot be parsed
    - the TLE norad ID does not correspond to the requested satellite.

    If the satellite is not found or the client is not authorized for it, the request will return
    a `NOT_FOUND` error.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetTle(self, request, context):
    """Gets the TLE for a satellite.

    The returned TLE will be the one that has the latest epoch known to StellarStation, and is
    used when calculating satellite orbits.

    If the satellite is not found or the client is not authorized for it, the request will return
    a `NOT_FOUND` error.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_StellarStationServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'ListPlans': grpc.unary_unary_rpc_method_handler(
          servicer.ListPlans,
          request_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ListPlansRequest.FromString,
          response_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ListPlansResponse.SerializeToString,
      ),
      'CancelPlan': grpc.unary_unary_rpc_method_handler(
          servicer.CancelPlan,
          request_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.CancelPlanRequest.FromString,
          response_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.CancelPlanResponse.SerializeToString,
      ),
      'ListUpcomingAvailablePasses': grpc.unary_unary_rpc_method_handler(
          servicer.ListUpcomingAvailablePasses,
          request_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ListUpcomingAvailablePassesRequest.FromString,
          response_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ListUpcomingAvailablePassesResponse.SerializeToString,
      ),
      'OpenSatelliteStream': grpc.stream_stream_rpc_method_handler(
          servicer.OpenSatelliteStream,
          request_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.SatelliteStreamRequest.FromString,
          response_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.SatelliteStreamResponse.SerializeToString,
      ),
      'ReservePass': grpc.unary_unary_rpc_method_handler(
          servicer.ReservePass,
          request_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ReservePassRequest.FromString,
          response_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.ReservePassResponse.SerializeToString,
      ),
      'AddTle': grpc.unary_unary_rpc_method_handler(
          servicer.AddTle,
          request_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.AddTleRequest.FromString,
          response_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.AddTleResponse.SerializeToString,
      ),
      'GetTle': grpc.unary_unary_rpc_method_handler(
          servicer.GetTle,
          request_deserializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.GetTleRequest.FromString,
          response_serializer=stellarstation_dot_api_dot_v1_dot_stellarstation__pb2.GetTleResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'stellarstation.api.v1.StellarStationService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
