package com.github.rossdanderson.stateless4k.config

internal class GroupTriggerConfiguration<S, T : Any, V>(
    private val stateConfiguration: StateConfiguration<S, T, V>,
    private val triggerConfigurations: Collection<TriggerConfiguration<S, T, V>>
) : TriggerConfiguration<S, T, V> {

    override fun transitionTo(state: S): StateConfiguration<S, T, V> {
        triggerConfigurations.forEach { it transitionTo state }
        return stateConfiguration
    }

    override fun doNothing(): StateConfiguration<S, T, V> {
        triggerConfigurations.forEach { it.doNothing() }
        return stateConfiguration
    }

    override fun reenter(): StateConfiguration<S, T, V> {
        triggerConfigurations.forEach { it.reenter() }
        return stateConfiguration
    }
}
