import Foundation

extension AppState {
    static func reducer(state: inout AppState, action: AppAction) {
        switch action {
        case .empty:
            break

        case .flushState:
            state = AppState()

        case let .changeFlow(flow):
            state.currentFlow = flow

        case let .accountsAction(action):
            AccountsState.reducer(state: &state.accountsState, action: action)

        case let .registrationAction(action):
            RegistrationState.reducer(state: &state.registrationState, action: action)
        }
    }
}
