@file:Suppress("HardCodedStringLiteral")

package eu.gaudian.translator.view.hints

import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.navigation.NavController
import eu.gaudian.translator.R

/**
 * Hint metadata mapping Markdown filenames to their string resource titles.
 * All hint-related operations are available as functions on each enum entry.
 */
@Suppress("HardCodedStringLiteral")
enum class HintDefinition(
    val markdownFile: String,
    val titleRes: Int
) {
    ADD_MODEL_SCAN("find_ai_model", R.string.hint_scan_hint_title),
    API_KEY("api_key_hint", R.string.hint_how_to_connect_to_an_ai),
    CATEGORY("category_hint", R.string.category_hint_intro),
    DICTIONARY_OPTIONS("dictionary_hint", R.string.label_dictionary_options),
    EXERCISE("exercise_hint", R.string.label_exercise),
    VOCABULARY_GENERATE_AI("import_hint", R.string.hint_how_to_generate_vocabulary_with_ai),
    LEARNING_STAGES("learning_stages_hint", R.string.learning_stages_title),
    REVIEW("review_hint", R.string.review_intro),
    SORTING("sorting_hint", R.string.sorting_hint_title),
    TRANSLATION("translation_hint", R.string.hint_translate_how_it_works),
    VOCABULARY_PROGRESS("vocabulary_progress_hint", R.string.hint_vocabulary_progress_hint_title);

    /** Creates the Hint data class for this hint definition. */
    @Composable
    fun hint() = Hint(titleRes = titleRes, elements = listOf(HintElement.LocalizedMarkdown(markdownFile)))

    /** Renders this hint's content. */
    @Composable
    fun Render() = hint().Render()
}

@Composable
fun hint(definition: HintDefinition): Hint = definition.hint()

@Composable fun HintScreen(navController: NavController, definition: HintDefinition) = HintScreen(
    navController = navController,
    title = stringResource(definition.titleRes),
    content = { definition.Render() }
)







