@file:Suppress("HardCodedStringLiteral")

package eu.gaudian.translator.model.communication

import com.google.gson.annotations.SerializedName

/**
 * Schema for OpenAI-compatible list models response, extended with optional fields
 * that some providers (OpenRouter, Mistral, etc.) may include. All extra fields are
 * nullable so unknown providers won't break deserialization.
 */
data class ModelsListResponse(
    val data: List<ModelItem> = emptyList()
)

/**
 * A conservative union of known fields from various providers.
 */
data class ModelItem(
    val id: String,
    // Owner / organization
    @SerializedName("owned_by") val ownedBy: String? = null,
    @SerializedName("organization") val organization: String? = null,

    // Object type (OpenAI: "model")
    @SerializedName("object") val objectType: String? = null,

    // Human-friendly name
    @SerializedName("display_name") val displayName: String? = null,
    @SerializedName("title") val title: String? = null,
    @SerializedName("name") val name: String? = null,

    // Description and tags
    @SerializedName("description") val description: String? = null,
    @SerializedName("tags") val tags: List<String>? = null,

    // Capabilities / features
    @SerializedName("capabilities") val capabilities: Capabilities? = null,

    // Context window (various naming across providers)
    @SerializedName("context_length") val contextLength: Int? = null,
    @SerializedName("max_context") val maxContext: Int? = null,
    @SerializedName("token_limit") val tokenLimit: Int? = null,

    // Pricing information (if provided)
    @SerializedName("pricing") val pricing: Pricing? = null,

    // Lifecycle
    @SerializedName("created") val created: Long? = null,
    @SerializedName("deprecated") val deprecated: Boolean? = null,
    @SerializedName("deprecation_date") val deprecationDate: String? = null,

    // Family / type
    @SerializedName("family") val family: String? = null,
    @SerializedName("type") val type: String? = null,

    // Aliases that may point to canonical models
    @SerializedName("aliases") val aliases: List<String>? = null
)

// Nested shapes that some providers use

data class Capabilities(
    val vision: Boolean? = null,
    val audio: Boolean? = null,
    val tools: Boolean? = null,
    val json: Boolean? = null,
    val reasoning: Boolean? = null
)

data class Pricing(
    // Prices may come in different units; commonly per 1K or 1M tokens. We store raw doubles.
    @SerializedName("prompt") val input: Double? = null,
    @SerializedName("completion") val output: Double? = null,
    @SerializedName("image") val image: Double? = null,
    @SerializedName("request") val request: Double? = null,
    // Alternative naming sometimes used
    @SerializedName("input") val inputAlt: Double? = null,
    @SerializedName("output") val outputAlt: Double? = null,
    @SerializedName("unit") val unit: String? = null,
    @SerializedName("currency") val currency: String? = null
)