package com.example.wabi.domain.navigation

import android.util.Log
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import com.example.wabi.domain.repository.UserShareDate
import com.example.wabi.view.screeens.basket.Basket
import com.example.wabi.view.screeens.catalog.Catalog
import com.example.wabi.view.screeens.logIn.LogIn
import com.example.wabi.view.screeens.onboard.Onboard
import com.example.wabi.view.screeens.profile.Profile

@Composable
fun Navigation(
    navHostController: NavHostController, start: String, isBottomBar: MutableState<Boolean>
) {

    NavHost(
        navController = navHostController, startDestination = start

    ) {
        composable(Routes.BASKET) {
            isBottomBar.value = true
            Log.d("navigation", "go to BASKET")
            Basket(navHostController)
        }
        composable(Routes.ONBOARD) {
            isBottomBar.value = false
            Log.d("navigation", "go to ONBOARD")
            Onboard(navHostController)
        }
        composable(Routes.CATALOG) {
            Log.d("navigation", "go to CATALOG")
            Catalog(navHostController)
        }
        composable(Routes.PROFILE) {
            if (UserShareDate.userIsLogging.value) {
                Log.d("navigation", "go to PROFILE")
                Profile(navHostController)
            } else {
                Log.d("navigation", "go to LOGIN")
                LogIn(navHostController)
            }
        }
    }
}