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

query journeys(
  $fromLat: Float!,
  $fromLon: Float!,
  $toLat: Float!,
  $toLon: Float!,
  $dateTime: DateTime!,
  $arriveBy: Boolean!,
  $maxResults: Int!
) {
  plan: trip (
        from: { coordinates: { latitude: $fromLat, longitude: $fromLon } }
        to:   { coordinates: { latitude: $toLat,   longitude: $toLon } }
        dateTime: $dateTime
        arriveBy: $arriveBy
        numTripPatterns: $maxResults
    ) {
    itineraries: tripPatterns {
      legs {
        startTime: aimedStartTime
        endTime: aimedEndTime
        realTime: realtime
        expectedStartTime
        expectedEndTime
        distance
        mode
        transitLeg: ride
        from: fromPlace {
          name
          lat: latitude
          lon: longitude
          stop: quay {
            platformCode: publicCode
            description
            id
            timezone
          }
        }
        to: toPlace {
          name
          lat: latitude
          lon: longitude
          stop: quay {
            platformCode: publicCode
            id
            timezone
          }
        }
        line {
          presentation {
            color: colour
            textColor: textColour
          }
          transportMode
          type: transportSubmode
          shortName: publicCode
          name
          alerts: situations {
            alertHeaderTextTranslations: summary {
                language
                text: value
            }
            alertDescriptionTextTranslations: description {
                language
                text: value
            }
          }
        }
        intermediateStops: intermediateEstimatedCalls {
          stop: quay {
            id
            name
            platformCode: publicCode
            lat: latitude
            lon: longitude
            timezone
          }
          scheduledArrivalTime: aimedArrivalTime
          expectedArrivalTime: actualArrivalTime
          scheduledDepartureTime: aimedDepartureTime
          expectedDepartureTime: actualDepartureTime
        }
        legGeometry: pointsOnLink {
          length
          points
        }
      }
    }
  }
}
