package com.fastest.pass.mastersignup.utils

import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import com.fastest.pass.mastersignup.presentation.ui.MasterSignUpFragment

class MasterSignUpNavigation {

    fun navigate(masterSignUpFragment: MasterSignUpFragment) {
        masterSignUpFragment.lifecycleScope.launchWhenStarted {
            masterSignUpFragment.viewmodel.router.collect { router ->
                when (router) {
                    MasterSignUpRoute.GoBackToSignUp -> {
                        masterSignUpFragment.findNavController().popBackStack()
                    }
                    MasterSignUpRoute.OpenHomeScreen -> {}
                    MasterSignUpRoute.OpenNoneScreen -> {}
                }

                masterSignUpFragment.viewmodel.navigateTo(MasterSignUpRoute.OpenNoneScreen)
            }
        }
    }
}