package dev.ulfrx.recipe.ui.screens.pantry

import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import dev.ulfrx.recipe.ui.components.calendar.HorizonCalendarPill
import dev.ulfrx.recipe.ui.theme.RecipeTheme
import kotlinx.datetime.LocalDate
import org.jetbrains.compose.resources.stringResource
import recipe.composeapp.generated.resources.Res
import recipe.composeapp.generated.resources.pantry_shortfall_count

@Composable
fun PantryHorizonPill(
    selectedDate: LocalDate,
    expanded: Boolean,
    today: LocalDate,
    onExpandedChange: (Boolean) -> Unit,
    onSelectDate: (LocalDate) -> Unit,
    modifier: Modifier = Modifier,
) {
    HorizonCalendarPill(
        selectedDate = selectedDate,
        expanded = expanded,
        today = today,
        onExpandedChange = onExpandedChange,
        onSelectDate = onSelectDate,
        trailing = {
            BasicText(
                text = stringResource(Res.string.pantry_shortfall_count, DUMMY_SHORTFALLS),
                style = RecipeTheme.typography.label.copy(color = RecipeTheme.colors.destructive),
                maxLines = 1,
            )
        },
        modifier = modifier,
    )
}

private const val DUMMY_SHORTFALLS = 7
