package com.example.triphelper.view.mainActivity

import android.annotation.SuppressLint
import android.os.Build
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.annotation.RequiresApi
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.navigation.compose.rememberNavController
import com.example.studybuddy.view.panels.bottombar.BottomBar
import com.example.studybuddy.view.panels.topbar.TopBarApp
import com.example.triphelper.view.navigation.Navigation
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
    @SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
    @RequiresApi(Build.VERSION_CODES.O)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            val controller = rememberNavController()
            val barsIsVisible = remember { mutableStateOf(false) }
            val iconsLawIsActivity = remember { mutableStateOf(false) }
            val iconsProfileIsActivity = remember { mutableStateOf(false) }
            val iconsAdviceIsActivity = remember { mutableStateOf(false) }
            val iconsMainIsActivity = remember { mutableStateOf(false) }
            val iconsRoutsIsActivity = remember { mutableStateOf(false) }
            Scaffold(
                topBar = {
                    if (barsIsVisible.value) {
                        TopBarApp(controller)
                    }
                },
                bottomBar = {
                    if (barsIsVisible.value) {
                        BottomBar(controller, iconsLawIsActivity,iconsProfileIsActivity, iconsAdviceIsActivity, iconsMainIsActivity, iconsRoutsIsActivity)
                    }
                }
            ) {
                Navigation(controller, barsIsVisible, iconsLawIsActivity, iconsProfileIsActivity, iconsAdviceIsActivity, iconsMainIsActivity, iconsRoutsIsActivity)
            }
        }
    }
}
