import APIClient
import ComposableArchitecture

public extension WaveformEditor {
    // Helper that allows us to invoke WaveformEditorPlayer
    // actions directly from the WaveformEditor reducer
    var playerCoordinator: some ReducerOf<Self> {
        Scope(state: \.player, action: \.player) {
            WaveformEditorPlayer()
        }
    }

    func playerAction(_ action: WaveformEditorPlayer.Action, state: inout State) -> Effect<Action> {
        return playerCoordinator.reduce(into: &state, action: .player(action))
    }
}
