package com.fastest.pass.home.utils

import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import com.fastest.pass.R
import com.fastest.pass.home.presentation.ui.fragment.NewItemFormFragment

class NewItemFormNavigation {

    fun navigate(newItemFormFragment: NewItemFormFragment) {
        newItemFormFragment.lifecycleScope.launchWhenStarted {
            newItemFormFragment.viewmodel.router.collect { router ->
                when (router) {
                    NewItemFormRoute.GoBackAddNewItemsScreen -> {
                        newItemFormFragment.findNavController().popBackStack()
                    }
                    NewItemFormRoute.GoBackHomeScreen -> {}
                    NewItemFormRoute.OpenNoneScreen -> {}
                }
            }
        }
    }
}