 import Foundation
 import GaussKrueger
 
-public struct RoutesResponse {
+public struct RoutesResponse: Decodable {
     public let routes: [Route]
     public let sessionId: String
-}
-
-public struct Route {
+
+    private enum CodingKeys: String, CodingKey {
+        case routes = "Routes"
+        case sessionId = "SessionId"
+    }
+}
+
+public struct Route: Decodable {
     public let priceLevel: Int?
     public let price: String?
     public let duration: Int

}

extension Route {
    public static func find(fromWithID originId: String, toWithID destinationId: String, time: Date = Date(), dateIsArrival: Bool = false, allowShortTermChanges: Bool = true, mobilityRestriction: MobilityRestriction = .none, session: URLSession = .shared, completion: @escaping (Result<RoutesResponse>) -> Void) {
        let data: [String: Any] = [
            "origin": originId,
            "destination": destinationId,

    }

    /// Convenience function taking to stop names instead of IDs. Sends of two find requests first.
    public static func find(from origin: String,
                            to destination: String,
                            time: Date = Date(),
                            dateIsArrival: Bool = false,
                            allowShortTermChanges: Bool = true,
                            mobilityRestriction: MobilityRestriction = .none,
                            session: URLSession = .shared,
                            completion: @escaping (Result<RoutesResponse>) -> Void) {
        Stop.find(origin, session: session) { result in
            switch result {
            case let .failure(error): completion(Result(failure: error))
