package com.example.iplace.main.viewModel

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.example.iplace.main.viewModel.dataView.FavouritesV
import com.example.iplace.main.viewModel.dataView.MenuV
import com.example.iplace.main.viewModel.dataView.PlaceV
import com.example.iplace.main.viewModel.dataView.PolicyConditionality
import com.example.iplace.main.viewModel.dataView.Profile
import com.example.iplace.main.viewModel.dataView.SplashScreen
import com.example.iplace.main.viewModel.mainView.AddPlace
import com.example.iplace.main.viewModel.mainView.Auth
import com.example.iplace.main.viewModel.mainView.ChangingPassword
import com.example.iplace.main.viewModel.mainView.CreatingUser
import com.example.iplace.main.viewModel.mainView.PasswordRecovery
import com.example.iplace.main.viewModel.mainView.PasswordVerification
import com.example.iplace.main.viewModel.mainView.Registration
import com.example.iplace.main.viewModel.mainView.SelectEnter
import com.example.iplace.main.viewModel.mainView.UserSettings


@RequiresApi(Build.VERSION_CODES.O)
@Composable
fun Navigation(controller: NavHostController) {

    NavHost(
        navController = controller,
        startDestination = View.splashScreen.route
    ){
        composable(View.splashScreen.route){
            SplashScreen(controller)
        }

        composable(View.selectEnter.route){
            SelectEnter(controller)
        }
        composable(View.auth.route){
            Auth(controller)
        }
        composable(View.passwordRecovery.route){
            PasswordRecovery(controller)
        }
        composable(View.registration.route){
            Registration(controller)
        }
        composable(View.creatingUser.route){
            CreatingUser(controller)
        }
        composable(View.policyConditionality.route){
            PolicyConditionality(controller)
        }
        composable(View.profile.route){
            Profile(controller)
        }
        composable(View.userSettings.route){
            UserSettings(controller)
        }
        composable(View.passwordVerification.route){
            PasswordVerification(controller)
        }
        composable(View.changingPassword.route){
            ChangingPassword(controller)
        }
        composable(View.menuV.route){
            MenuV(controller)
        }
        composable(View.favouritesV.route){
            FavouritesV(controller)
        }
        composable(View.placeV.route + "/{placeId}") { backStackEntry ->
            val placeId = backStackEntry.arguments?.getString("placeId") ?: ""
            PlaceV(controller, placeId)
        }
        composable(View.addPlace.route){
            AddPlace(controller)
        }


    }
}