using System.Text.Json.Serialization;

namespace Updater;

public class UpdaterSettings
{
    [JsonInclude]
    [JsonPropertyName("self_contained")]
    public bool SelfContained { get; set; } = false;

    [JsonInclude]
    [JsonPropertyName("updater")]
    public string? Updater { get; set; } = null;
    
    [JsonInclude]
    [JsonPropertyName("branch")]
    public Branch Branch { get; set; } = Branch.Beta;

    [JsonInclude]
    [JsonPropertyName("platform")]
    public string Platform { get; set; } = "linux-x64";

    [JsonInclude]
    [JsonPropertyName("auto_launch")]
    public bool AutoLaunch { get; set; } = true;
    
    [JsonInclude]
    [JsonPropertyName("update_check")]
    public bool AutoUpdateCheck { get; set; } = true;
}

public enum Branch : short
{
    Dev,
    Beta,
    Master,
}

[JsonSerializable(typeof(UpdaterSettings))]
[JsonSourceGenerationOptions(
    GenerationMode = JsonSourceGenerationMode.Default,
    WriteIndented = true)]
internal partial class UpdaterSettingsContext : JsonSerializerContext
{

}