package com.example.oscellamobile.Navigation

import androidx.compose.runtime.Composable
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.example.oscellamobile.screens.AboutCloud
import com.example.oscellamobile.screens.AboutCompany
import com.example.oscellamobile.screens.AboutGame
import com.example.oscellamobile.screens.Auth
import com.example.oscellamobile.screens.AuthWithEmail
import com.example.oscellamobile.screens.CloudList
import com.example.oscellamobile.screens.CompanyList
import com.example.oscellamobile.screens.MainWindow
import com.example.oscellamobile.screens.PersonalView
import com.example.oscellamobile.screens.Registration
import com.example.oscellamobile.screens.SplashScreen
@Composable
fun Navigation() {
    val navController = rememberNavController()
    NavHost(navController = navController,
        startDestination = "SplashScreen")
    {
        composable("SplashScreen"){
            SplashScreen(navController)
        }
        composable("Auth"){
            Auth(navController)
        }
        composable("AuthWithEmail") {
            AuthWithEmail(navController)
        }
        composable("Registration") {
            Registration(navController)
        }
        composable("MainWindow/{flag}"){ backStackEntry ->
            val flag = backStackEntry.arguments?.getString("flag")?.toInt() ?: 0
            MainWindow(navController, flag)
        }
        composable("CompanyList")
        {
            CompanyList(navController)
        }
        composable("CloudList")
        {
            CloudList(navController)
        }
        composable("AboutGame/{id}") { backStackEntry ->
            val id = backStackEntry.arguments?.getString("id")?.toInt() ?: 0
            AboutGame(navController, id)
        }
        composable("AboutCloud/{id}") { backStackEntry ->
            val id = backStackEntry.arguments?.getString("id")?.toInt() ?: 0
            AboutCloud(navController, id)
        }
        composable("AboutCompany/{id}") { backStackEntry ->
            val id = backStackEntry.arguments?.getString("id")?.toInt() ?: 0
            AboutCompany(navController, id)
        }
        composable("PersonalView")
        {
            PersonalView(navController)
        }
    }
}