         return self.id.hashValue
     }
 }
-
-extension Departure.State: Equatable {}
-public func == (lhs: Departure.State, rhs: Departure.State) -> Bool {
-    switch (lhs, rhs) {
-    case (.onTime, .onTime): return true
-    case (.delayed, .delayed): return true
-    case let (.other(x), .other(y)): return x == y
-    case (.unknown, .unknown): return true
-    default: return false
-    }
-}

    }

    /// Convenience function taking a stop name. Sends of a find request first and uses the first result's `id` as an argument for the monitor request.
    public static func monitor(stopWithName name: String, date: Date = Date(), dateType: DateType = .arrival, allowedModes modes: [Mode] = Mode.all, allowShorttermChanges: Bool = true, session: URLSession = .shared, completion: @escaping (Result<MonitorResponse>) -> Void) {
        Stop.find(name, session: session) { result in
            switch result {
            case let .failure(error): completion(Result(failure: error))

    }
}

// MARK: - API

extension Departure {
    public static func monitor(stopWithId id: String,
                               date: Date = Date(),
                               dateType: DateType = .arrival,
                               allowedModes modes: [Mode] = Mode.all,
                               allowShorttermChanges: Bool = true,
                               session: URLSession = .shared,
                               completion: @escaping (Result<MonitorResponse>) -> Void) {
        let data: [String: Any] = [
            "stopid": id,
            "time": date.iso8601,
