@file:Suppress("PropertyName")

package eu.gaudian.translator.model.grammar

import kotlinx.serialization.Serializable

/**
 * Represents the entire language configuration file (e.g., de.json).
 *
 * @param language_code The ISO code for the language (e.g., "de").
 * @param articles A list of articles for the language (e.g., "der", "die"). This is optional.
 * @param categories A map where the key is the category name (e.g., "noun")
 * and the value contains the details for that category.
 */
@Serializable
data class LanguageConfig(
    val language_code: String,
    val articles: List<String>? = null,
    val categories: Map<String, CategoryConfig>
)

@Serializable
data class CategoryConfig(
    @Suppress("PropertyName") val display_key: String,
    val fields: List<FieldConfig>,
    val formatter: String? = null,
    val mappings: Map<String, Map<String, String>>? = null,
    /** Optional configuration for how verb conjugations should be displayed. */
    val conjugation_display: VerbConjugationDisplayConfig? = null,
    /** Optional configuration for how noun declension tables should be displayed. */
    val declension_display: NounDeclensionDisplayConfig? = null
)

@Serializable
data class VerbConjugationDisplayConfig(
    /** Default pronoun order for this language's verb tables. */
    val pronouns: List<String>? = null,
    /** Mapping from internal tense keys (e.g., "present") to display labels (e.g., "Präsens"). */
    val tense_labels: Map<String, String>? = null
)

@Serializable
data class NounDeclensionDisplayConfig(
    /** Ordered list of case keys to display as rows. */
    val cases_order: List<String>? = null,
    /** Mapping from case keys to display labels (e.g., "nominative" -> "Nom."). */
    val case_labels: Map<String, String>? = null,
    /** Ordered list of number keys to display as columns (e.g., ["singular", "plural"]). */
    val numbers_order: List<String>? = null,
    /** Mapping from number keys to display labels (e.g., "singular" -> "Sing."). */
    val number_labels: Map<String, String>? = null
)

@Serializable
data class FieldConfig(
    val key: String,
    val display_key: String,
    val type: String,
    val options: List<String>? = null
)