 import UIKit
+
+enum SearchBarExtendedViewButtonType {
+    case sort
+    case cancel
+    
+    var title: String {
+        switch self {
+        case .sort:
+        return CommonStrings.sortActionTitle
+        case .cancel:
+        return CommonStrings.cancelActionTitle
+        }
+    }
+}
 
 protocol SearchBarExtendedViewControllerDataSource: class {
     func returnKeyType(for searchBar: UISearchBar) -> UIReturnKeyType
     func placeholder(for searchBar: UISearchBar) -> String?
     func isSeparatorViewHidden(above searchBar: UISearchBar) -> Bool
+    func buttonType(for button: UIButton, currentButtonType: SearchBarExtendedViewButtonType?) -> SearchBarExtendedViewButtonType?
 }
 
 protocol SearchBarExtendedViewControllerDelegate: class {

    
    func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
        delegate?.searchBarTextDidBeginEditing(searchBar)
    }
    
    func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
        delegate?.searchBarTextDidEndEditing(searchBar)
    }
    
    func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {

    @IBOutlet weak var separatorView: UIView!
    @IBOutlet weak var searchBar: UISearchBar!
    @IBOutlet weak var button: UIButton!
    private var buttonType: SearchBarExtendedViewButtonType? {
        didSet {
            button.setTitle(buttonType?.title, for: .normal)
        }
    }
    
    weak var dataSource: SearchBarExtendedViewControllerDataSource?
    weak var delegate: SearchBarExtendedViewControllerDelegate?
