package eu.gaudian.translator.view.exercises

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.NavHostController
import eu.gaudian.translator.R
import eu.gaudian.translator.view.composable.AppButton
import eu.gaudian.translator.view.composable.AppTopAppBar
import eu.gaudian.translator.view.vocabulary.AllCardsListScreen

@Composable
fun ExerciseVocabularyScreen(
    onStartExercise: () -> Unit,
    navController: NavController
) {
    Scaffold(
        topBar = {
            AppTopAppBar(title =stringResource(R.string.text_new_vocabulary_for_this_exercise))
        },
        bottomBar = {
            Surface(shadowElevation = 8.dp) {
                AppButton(
                    onClick = onStartExercise,
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(16.dp)
                ) {
                    Text(stringResource(R.string.label_start_exercise))
                }
            }
        }
    ) { paddingValues ->
        Box(modifier = Modifier.padding(paddingValues)) {

            AllCardsListScreen(
                navController = navController as NavHostController?,
                onNavigateToItem = { item ->
                    // Navigate to the detail screen for a specific vocabulary item
                    @Suppress("HardCodedStringLiteral")
                    navController.navigate("vocabulary_detail/${item.id}")
                },
                onNavigateBack = { /* Not needed in this context */ },
            )
        }
    }
}