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.UserData
import com.example.wabi.view.screens.basket.Basket
import com.example.wabi.view.screens.catalog.Catalog
import com.example.wabi.view.screens.onboard.screeen.Onboard
import com.example.wabi.view.screens.profile.Profile
import com.example.wabi.view.screens.signIn.SignIn
import com.example.wabi.view.screens.signUp.SignUp

//инициализация контроллера навигации
@Composable
fun Navigation(
    controller: NavHostController,
    visibleBB: MutableState<Boolean>,
    visibleTB: MutableState<Boolean>,
) {
    NavHost(
        navController = controller, startDestination = Routes.BASKET
    ) {
        composable(Routes.BASKET) {
            UserData.currentScreen = Routes.BASKET
            visibleBB.value = true
            Log.d("Navigation ->", "nav to ${Routes.BASKET}")
            Basket(navController = controller)
        }
        composable(Routes.ONBOARD) {
            UserData.currentScreen = Routes.ONBOARD
            Log.d("Navigation ->", "nav to ${Routes.ONBOARD}")
            visibleBB.value = false
            Onboard(navController = controller)
        }
        composable(Routes.SIGNIN) {
            UserData.currentScreen = Routes.SIGNIN
            Log.d("Navigation ->", "nav to  ${Routes.SIGNIN}")
            visibleBB.value = true
            SignIn(navController = controller)
        }
        composable(Routes.SIGNUP) {
            UserData.currentScreen = Routes.SIGNUP
            Log.d("Navigation ->", "nav to  ${Routes.SIGNUP}")
            visibleBB.value = false
            SignUp(navController = controller)
        }
        composable(Routes.PROFILE) {
            UserData.currentScreen = Routes.PROFILE
            Log.d("Navigation ->", "nav to ${Routes.PROFILE}")
            visibleBB.value = true
            Profile(navController = controller)
        }
        composable(Routes.CATALOG) {
            UserData.currentScreen = Routes.CATALOG
            Log.d("Navigation ->", "nav to  ${Routes.CATALOG}")
            visibleBB.value = true
            Catalog(navController = controller)
        }
    }
}