package de.tsschulz.tt_tagebuch.app.ui

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.DateRange
import androidx.compose.material.icons.filled.Person
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.Navigator

class HomeScreen(private val clubId: Int) : Screen {
    @Composable
    override fun Content() {
        var selectedItem by remember { mutableStateOf(0) }
        val titles = listOf("Tagebuch", "Mitglieder")
        val icons = listOf(Icons.Default.DateRange, Icons.Default.Person)

        Scaffold(
            bottomBar = {
                BottomNavigation {
                    titles.forEachIndexed { index, title ->
                        BottomNavigationItem(
                            icon = { Icon(icons[index], contentDescription = title) },
                            label = { Text(title) },
                            selected = selectedItem == index,
                            onClick = { selectedItem = index }
                        )
                    }
                }
            }
        ) { padding ->
            Box(modifier = Modifier.padding(padding)) {
                when (selectedItem) {
                    0 -> DiaryScreen(clubId).Content()
                    1 -> MemberScreen(clubId).Content()
                }
            }
        }
    }
}
