 
 import RxSwift
 
+/// Helper class that manages real-time updates for trips. Also handles
+/// switching to a different trip.
 public class TKTripRealTimeUpdater {
   
-  public init(trip: Trip? = nil) {
+  public init(trip: Trip? = nil, timeBetweenUpdates: TimeInterval = 10) {
     tripVar = Variable(trip)
+    self.timeBetweenUpdates = timeBetweenUpdates
     
     let currentTrip = tripVar.asObservable().filter { $0 != nil }.map { $0! }.distinctUntilChanged()
     let enabled = enabledVar.asObservable().distinctUntilChanged()

  }
  
  private let realTime = TKBuzzRealTime()
  private let timeBetweenUpdates: TimeInterval = 10

  private var tripVar: Variable<Trip?>
  private var enabledVar = Variable(true)
  private var updated = PublishSubject<Trip>()
  private let disposeBag = DisposeBag()

  public var trip: Trip? {
    get { return tripVar.value }
    set { tripVar.value = newValue }
  }
  
  public var isEnabled: Bool {
    get { return enabledVar.value }
    set { enabledVar.value = newValue }
  }
  
  public var rx_updated: Observable<Trip> { return updated }
  
  private func update() {

      })
  }
  
}
