package ch.dissem.yaep.domain

class GameRow<C : ItemClass<C>>(
    val category: ItemClassCompanion<C>,
    val options: List<Item<C>>,
    val cells: List<GameCell<C>>
) : List<GameCell<C>> by cells {
    fun indexOf(element: C) = indexOfFirst { it.selection?.itemType == element }

    fun updateOptions() {
        val selections = mapNotNull { it.selection }
        forEach { it.options.removeAll(selections) }
    }
}
