//
//  DefaultLoginNavigator.swift
//  iosApp
//
//  Created by Coach Roebuck on 8/14/23.
//  Copyright © 2023 orgName. All rights reserved.
//

import Foundation
import shared

class DefaultLoginNavigator: LoginNavigator {
    
    var selectionStore: SelectionStore
    
    init(selectionStore: SelectionStore) {
        self.selectionStore = selectionStore
    }

    func emit(loginNavigatorIntent intent: LoginNavigatorStore.Intent) {
        if let _ = intent as? LoginNavigatorStore.IntentRegister {
            onRegister()
        } else if let _ = intent as? LoginNavigatorStore.IntentActivate {
            onActivate()
        } else if let _ = intent as? LoginNavigatorStore.IntentMagicLinkSent {
            onMagicLinkSent()
        } else if let _ = intent as? LoginNavigatorStore.IntentIdle {
            onIdle()
        }
    }
    
    private func onRegister() {
        selectionStore.selection = "Register"
    }
    
    private func onActivate() {
        selectionStore.selection = "Activate"
    }
    
    private func onMagicLinkSent() {
        selectionStore.selection = "MagicLinkSent"
    }
    
    private func onIdle() {
    }
}
