package com.example.wabi.view.screeens.onboard

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import androidx.navigation.NavHostController
import com.example.wabi.domain.navigation.NavigationProvider
import com.example.wabi.domain.navigation.Routes
import com.example.wabi.domain.repository.PrefManager
import com.example.wabi.domain.repository.UserShareDate
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class OnboardViewModel @Inject constructor(private val nav: NavigationProvider) : ViewModel() {
    fun closeOnboard(navHostController: NavHostController) {
        viewModelScope.launch {
            PrefManager.initPrefManager(UserShareDate.context!!)
            PrefManager.onboard = false
        }
        nav.goToNextScreen(
            navHostController = navHostController,
            whereFrom = Routes.ONBOARD,
            where = Routes.BASKET
        )
    }
}