package com.fabledsword.minstrel.models.wire

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
 * Wire DTOs for the `/api/admin/tag-sources` admin surface (#1521).
 * Every field defaults defensively so a missing JSON key never crashes
 * deserialization. `versionBumped` is present only on the PATCH response.
 */
@Serializable
data class AdminTagSourceWire(
    val id: String = "",
    @SerialName("display_name") val displayName: String = "",
    @SerialName("requires_api_key") val requiresApiKey: Boolean = false,
    val supports: List<String> = emptyList(),
    val enabled: Boolean = false,
    @SerialName("api_key_set") val apiKeySet: Boolean = false,
    @SerialName("display_order") val displayOrder: Int = 0,
    val testable: Boolean = false,
    @SerialName("version_bumped") val versionBumped: Boolean = false,
)

@Serializable
data class AdminTagSourcesListWire(
    val providers: List<AdminTagSourceWire> = emptyList(),
    @SerialName("sources_version") val sourcesVersion: Int = 0,
)

@Serializable
data class TestTagSourceWire(
    val ok: Boolean = false,
    @SerialName("duration_ms") val durationMs: Long = 0,
    val error: String = "",
)
