using System.Text.Json.Serialization;

namespace Flo.Installer;

public sealed record Manifest(
    [property: JsonPropertyName("schemaVersion")] int SchemaVersion,
    [property: JsonPropertyName("product")] string Product,
    [property: JsonPropertyName("version")] string Version,
    [property: JsonPropertyName("channel")] string Channel,
    [property: JsonPropertyName("releasedAt")] DateTimeOffset ReleasedAt,
    [property: JsonPropertyName("minBootstrapperVersion")] string MinBootstrapperVersion,
    [property: JsonPropertyName("artifacts")] IReadOnlyList<Artifact> Artifacts);

public sealed record Artifact(
    [property: JsonPropertyName("id")] string Id,
    [property: JsonPropertyName("version")] string Version,
    [property: JsonPropertyName("platforms")] IReadOnlyDictionary<string, PlatformArtifact> Platforms);

public sealed record PlatformArtifact(
    [property: JsonPropertyName("url")] string Url,
    [property: JsonPropertyName("sha256")] string Sha256,
    [property: JsonPropertyName("sizeBytes")] long SizeBytes,
    [property: JsonPropertyName("archive")] string Archive,
    [property: JsonPropertyName("installPath")] string InstallPath);
