//
//  FilterOptionKind.swift
//  mundraub
//
//  Created by Oliver Krakora on 08.11.20.
//  Copyright © 2020 Oliver Ian Krakora. All rights reserved.
//

import Foundation
import ReactiveSwift
import mundraubKit

protocol FilterOptionKind {
    
    var name: String { get }
    var formattedName: String { get }
    var type: NodeType { get }
    var selectionState: Property<FilterOptionSelectionState> { get }
    
    func toggleSelectionState()
    
    func titleColor(isSelected: Bool) -> UIColor
    
    func backgroundColor(isSelected: Bool) -> UIColor
}

extension FilterOptionKind {
    
    func titleColor(isSelected: Bool) -> UIColor {
        isSelected ? .white : UIColor.white.withAlphaComponent(0.5)
    }
    
    func backgroundColor(isSelected: Bool) -> UIColor {
        isSelected ? type.color : type.color.withAlphaComponent(0.5)
    }
}
