package dev.ulfrx.recipe.ui.screens.home

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import dev.ulfrx.recipe.navigation.DockDestination
import dev.ulfrx.recipe.ui.components.empty.EmptyState
import dev.ulfrx.recipe.ui.theme.RecipeTheme
import org.jetbrains.compose.resources.stringResource
import recipe.composeapp.generated.resources.Res
import recipe.composeapp.generated.resources.empty_home_subtitle
import recipe.composeapp.generated.resources.empty_home_title
import recipe.composeapp.generated.resources.shell_tab_home

@Composable
fun HomeScreen(viewModel: HomeViewModel) {
    @Suppress("UNUSED_VARIABLE")
    val state by viewModel.state.collectAsStateWithLifecycle()

    Box(
        modifier = Modifier.fillMaxSize().background(RecipeTheme.colors.background),
    ) {
        Column(
            modifier =
                Modifier
                    .fillMaxSize()
                    .windowInsetsPadding(WindowInsets.statusBars)
                    .padding(top = RecipeTheme.spacing.xl),
            verticalArrangement = Arrangement.Top,
        ) {
            BasicText(
                text = stringResource(Res.string.shell_tab_home),
                style = RecipeTheme.typography.title.copy(color = RecipeTheme.colors.content),
                modifier = Modifier.padding(horizontal = RecipeTheme.spacing.lg),
            )
            Box(modifier = Modifier.fillMaxSize()) {
                EmptyState(
                    icon = DockDestination.Home.icon,
                    title = stringResource(Res.string.empty_home_title),
                    subtitle = stringResource(Res.string.empty_home_subtitle),
                )
            }
        }
    }
}
