using System.Text.Json.Serialization;
namespace Cepis;
///
/// The response of GET /health.
///
///
/// Good for two things: checking that the API answers, and knowing which
/// version of the database is live. The DNE database changes every two
/// weeks; identifies it.
///
public sealed record Health
{
///
/// "ok" when the API reports itself healthy. Wire name
/// status.
///
[JsonPropertyName("status")]
public string Status { get; init; } = "";
///
/// Identifier of the fortnightly DNE database behind the answers. Wire name
/// dne.
///
[JsonPropertyName("dne")]
public string Dne { get; init; } = "";
/// How many CEPs that database holds. Wire name ceps.
[JsonPropertyName("ceps")]
public long Ceps { get; init; }
///
/// How many of those CEPs carry a coordinate. Wire name geo.
///
[JsonPropertyName("geo")]
public long Geo { get; init; }
///
/// When the database was generated, as an ISO 8601 instant. Wire name
/// base_gerada_em.
///
[JsonPropertyName("base_gerada_em")]
public string BaseGeradaEm { get; init; } = "";
///
/// when the API reports itself healthy.
///
[JsonIgnore]
public bool Ok => Status == "ok";
}