 import RxSwift
 import TripKit
 
+/// An item that `TKUIModePicker` can display
 public protocol TKUIModePickerItem: Hashable {
+  
+  /// The default image to show for the mode. Items without images are ignored.
   var image: TKImage? { get }
+  
+  /// A textual representation for the image. Should describe the item. Used for accessibility support.
   var imageTextRepresentation: String { get }
+  
+  /// An optional URL to an image to replace the default image
   var imageURL: URL? { get }
+  
+  /// Whether `imageURL` points at an image that can be used in template mode
   var imageURLIsTemplate: Bool { get }
+
+  /// Whether `imageURL` points at an image which should not be displayed on coloured background
   var imageURLIsBranding: Bool { get }
 }
 

  static let separatorHeight: CGFloat       =  1
}

public class TKUIModePicker<Item>: UIView where Item: TKUIModePickerItem {
  
  private let disposeBag = DisposeBag()

  private var visibleModes: [Item] = []
  
  private var modeIsBranded: [Item: Bool] = [:]

  /// Configures the currently visible items
  ///
  /// - Note: you can call `configure` multiple times with different sets of items. The mode picker will keep track
  ///     of which items were previously selected (or not) and maintains that information even if the items are
  ///     temporarily removed from the `configure` method's `modes`
  ///
  /// - Parameters:
  ///   - modes: These are all the available/visible modes
  ///   - currentlyEnabled:  Optional handler to check if an item should be enabled; by default all are enabled
  public func configure(all modes: [Item], currentlyEnabled: (Item) -> Bool = { _ in true }) {

    // Need to set this first, as updating modes will trigger the observable
