# SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
# SPDX-License-Identifier: CC0-1.0

query departures(
    $lat: Float!,
    $lon: Float!,
    $startDateTime: DateTime!,
    $modes: [Mode]!
  ) {
  nearest(
        latitude: $lat,
        longitude: $lon,
        maximumDistance: 500,
        filterByPlaceTypes: quay,
        filterByModes: $modes
    ) {
    edges {
      node {
        place {
          ... on Quay {
            stop: stopPlace {
              id
              name
              lat: latitude
              lon: longitude
              timezone
            }
            stoptimes: estimatedCalls(startTime: $startDateTime, numberOfDepartures: 12) {
              stop: quay {
                platformCode: publicCode
              }
              scheduledArrival: aimedArrivalTime
              realtimeArrival: expectedArrivalTime
              scheduledDeparture: aimedDepartureTime
              realtimeDeparture: expectedDepartureTime
              realtime
              trip: serviceJourney {
                route: line {
                  transportMode
                  type: transportSubmode
                  shortName: publicCode
                  longName: name
                  bikesAllowed
                  agency: operator {
                      name
                  }
                  presentation {
                    color: colour
                    textColor: textColour
                  }
                  alerts: situations {
                    alertHeaderTextTranslations: summary {
                        language
                        text: value
                    }
                    alertDescriptionTextTranslations: description {
                        language
                        text: value
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
