@file:Suppress("HardCodedStringLiteral")

package eu.gaudian.translator.utils.dictionary

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

/**
 * Service for translating Part of Speech (POS) abbreviations to their full names in English.
 * This provides a reusable way to display POS information in English.
 */
object PartOfSpeechTranslator {

    @Composable
    fun translatePos(pos: String?): String {
        if (pos.isNullOrBlank()) {
            return ""
        }

        val normalizedPos = pos.lowercase().trim()

        // Map POS abbreviations to string resource names
        return when (normalizedPos) {
            "abbrev" -> stringResource(R.string.pos_abbrev)
            "adj" -> stringResource(R.string.pos_adj)
            "adj_noun" -> stringResource(R.string.pos_adj_noun)
            "adj_phrase" -> stringResource(R.string.pos_adj_phrase)
            "adnominal" -> stringResource(R.string.pos_adnominal)
            "adv" -> stringResource(R.string.pos_adv)
            "adv_phrase" -> stringResource(R.string.pos_adv_phrase)
            "affix" -> stringResource(R.string.pos_affix)
            "ambiposition" -> stringResource(R.string.pos_ambiposition)
            "article" -> stringResource(R.string.pos_article)
            "character" -> stringResource(R.string.pos_character)
            "circumfix" -> stringResource(R.string.pos_circumfix)
            "circumpos" -> stringResource(R.string.pos_circumpos)
            "classifier" -> stringResource(R.string.pos_classifier)
            "clause" -> stringResource(R.string.pos_clause)
            "combining_form" -> stringResource(R.string.pos_combining_form)
            "component" -> stringResource(R.string.pos_component)
            "conj" -> stringResource(R.string.pos_conj)
            "contraction" -> stringResource(R.string.pos_contraction)
            "converb" -> stringResource(R.string.pos_converb)
            "counter" -> stringResource(R.string.pos_counter)
            "det" -> stringResource(R.string.pos_det)
            "gerund" -> stringResource(R.string.pos_gerund)
            "hard-redirect" -> stringResource(R.string.pos_hard_redirect)
            "infix" -> stringResource(R.string.pos_infix)
            "interfix" -> stringResource(R.string.pos_interfix)
            "interj" -> stringResource(R.string.pos_interj)
            "intj" -> stringResource(R.string.pos_intj)
            "name" -> stringResource(R.string.pos_name)
            "noun" -> stringResource(R.string.pos_noun)
            "num" -> stringResource(R.string.pos_num)
            "onomatopoeia" -> stringResource(R.string.pos_onomatopoeia)
            "onomatopeia" -> stringResource(R.string.pos_onomatopeia)
            "participle" -> stringResource(R.string.pos_participle)
            "particle" -> stringResource(R.string.pos_particle)
            "phrase" -> stringResource(R.string.pos_phrase)
            "postp" -> stringResource(R.string.pos_postp)
            "prefix" -> stringResource(R.string.pos_prefix)
            "prep" -> stringResource(R.string.pos_prep)
            "prep_phrase" -> stringResource(R.string.pos_prep_phrase)
            "preverb" -> stringResource(R.string.pos_preverb)
            "pron" -> stringResource(R.string.pos_pron)
            "proverb" -> stringResource(R.string.pos_proverb)
            "punct" -> stringResource(R.string.pos_punct)
            "quantifier" -> stringResource(R.string.pos_quantifier)
            "romanization" -> stringResource(R.string.pos_romanization)
            "root" -> stringResource(R.string.pos_root)
            "soft-redirect" -> stringResource(R.string.pos_soft_redirect)
            "stem" -> stringResource(R.string.pos_stem)
            "suffix" -> stringResource(R.string.pos_suffix)
            "syllable" -> stringResource(R.string.pos_syllable)
            "symbol" -> stringResource(R.string.pos_symbol)
            "typographic variant" -> stringResource(R.string.pos_typographic_variant)
            "unknown" -> stringResource(R.string.pos_unknown)
            "verb" -> stringResource(R.string.pos_verb)
            else -> pos.replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
        }


    }

}