package com.example.development

import android.os.Bundle
import android.window.SplashScreen
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.example.development.mainActivity.components.RegistrationScreen
import com.example.development.ui.theme.DevelopmentTheme
import com.example.development.mainActivity.MainViewModel
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.example.development.mainActivity.components.AuthorizationScreen
import com.example.development.mainActivity.components.CreateReviews
import com.example.development.mainActivity.components.Loading
import com.example.development.mainActivity.components.MainPage
import com.example.development.mainActivity.components.MenuPage
import com.example.development.mainActivity.components.PasswordRecovery
import com.example.development.mainActivity.components.PasswordRecovery2
import com.example.development.mainActivity.components.RegistrationScreen2
import com.example.development.mainActivity.components.Reviews
import com.example.development.mainActivity.components.SplashScreen
import com.example.development.mainActivity.components.TableReserve
import com.example.development.mainActivity.components.TableReserve2
import com.example.development.mainActivity.components.UserProfile
import com.example.development.mainActivity.components.UserProfile2
import com.example.development.mainActivity.components.UserProfileForUnauthorizedUser

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent { val viewModel = MainViewModel()
            DevelopmentTheme {
                Surface(color = MaterialTheme.colorScheme.background) {
                    val navController = rememberNavController()

                    NavHost(
                        navController = navController,
                        startDestination = "RegistrationScreen"
                    ){
                        composable("SplashScreen")
                        {
                            SplashScreen(navController, viewModel)
                        }
                        composable("RegistrationScreen")
                        {
                            RegistrationScreen(navController, viewModel)
                        }
                        composable("RegistrationScreen2")
                        {
                            RegistrationScreen2(navController, viewModel)
                        }
                        composable("AuthorizationScreen")
                        {
                            AuthorizationScreen(navController, viewModel)
                        }
                        composable("MenuPage")
                        {
                            MenuPage(navController, viewModel)
                        }
                        composable("MainPage")
                        {
                            MainPage(navController, viewModel)
                        }
                        composable("Reviews")
                        {
                            Reviews(navController, viewModel)
                        }
                        composable("CreateReview")
                        {
                            CreateReviews(navController, viewModel)
                        }
                        composable("PasswordRecovery")
                        {
                            PasswordRecovery(navController, viewModel)
                        }
                        composable("PasswordRecovery2")
                        {
                            PasswordRecovery2(navController, viewModel)
                        }
                        composable("TableReserve")
                        {
                            TableReserve(navController, viewModel)
                        }
                        composable("TableReserve2")
                        {
                            TableReserve2(navController, viewModel)
                        }
                        composable("UserProfile")
                        {
                            UserProfile(navController, viewModel)
                        }
                        composable("UserProfile2")
                        {
                            UserProfile2(navController, viewModel)
                        }
                        composable("UserProfileForUnauthorizedUser")
                        {
                            UserProfileForUnauthorizedUser(navController)
                        }
                        composable("LoadingProfile")
                        {
                            Loading(navController, viewModel)
                        }
                    }
                }
            }
        }
    }
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    DevelopmentTheme {

    }
}