package com.fabledsword.minstrel.update.api

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import retrofit2.http.GET

/**
 * Retrofit interface for `GET /healthz` — unauthenticated health probe
 * returning the server's running version + the minimum client version
 * it'll talk to. Polled by [com.fabledsword.minstrel.connectivity.NetworkStatusController]
 * for both reachability and the VersionTooOld banner.
 */
interface HealthzApi {
    @GET("healthz")
    suspend fun check(): HealthzResponse
}

/**
 * Wire shape for /healthz. `minClientVersion` may be empty on older
 * servers; the caller treats empty as "skip" rather than "fail" so a
 * partial deploy doesn't gate the UI.
 */
@Serializable
data class HealthzResponse(
    val status: String = "",
    val version: String = "",
    @SerialName("min_client_version") val minClientVersion: String = "",
)
