 //
 
 import Foundation
+
+import RxSwift
 
 public struct SGCountdownCellModel {
   

  public var isCancelled: Bool = false
  public var isWheelchairEnabled: Bool = false
  public var isAccessible: Bool?
  public var alertInfo: AlertInfo = .empty
  
  public init(title: NSAttributedString, position: SGKGrouping = .edgeToEdge) {
    self.title = title

    
    // We may need to show accessibility info.
    configureAccessibleView(asEnabled: model.isWheelchairEnabled, isAccessible: model.isAccessible)
    
    // Occupancies, which might change with real-time
    if let occupancies = model.occupancies {
      occupancies.subscribe(onNext: { [weak self] occupancies in
        if occupancies.count > 1 || (occupancies.first?.count ?? 0) > 1 {
          let trainView = TKTrainOccupancyView()
          trainView.occupancies = occupancies
          self?.replaceFootnoteView(trainView)
        } else if let occupancy = occupancies.first?.first, occupancy != .unknown {
          let occupancyView = TKOccupancyView(with: .occupancy(occupancy))
          self?.replaceFootnoteView(occupancyView)
        }
      }).disposed(by: objcDisposeBag.disposeBag)
    }

  }
  
  
