using System.ComponentModel;
using System.Text.Json.Serialization;
using Luski.net.Enums;

namespace Luski.Classes;

public class UpdaterSettings
{
    [JsonInclude]
    [Shared.GlobalAttributes.DisplayName("Self Contained")]
    [Description("This tells the updater to download the self contained version of the app.")]
    [JsonPropertyName("self_contained")]
    public bool SelfContained { get; set; } = false;

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

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

    [JsonInclude]
    [Shared.GlobalAttributes.DisplayName("Auto Launch")]
    [Description("Tells the updater to relaunch the app after the update is complete.")]
    [JsonPropertyName("auto_launch")]
    public bool AutoLaunch { get; set; } = true;
    [JsonInclude]
    [Description("If the app can check for updates and an update is available, then the app will start the update process automatically.")]
    [Shared.GlobalAttributes.DisplayName("Auto Update")]
    [JsonPropertyName("auto_update")]
    public bool AutoUpdate { get; set; } = false;
    
    [JsonInclude]
    [Description("This will allow the client to check for update during the launch process.")]
    [Shared.GlobalAttributes.DisplayName("Check For Updates")]
    [JsonPropertyName("update_check")]
    public bool AutoUpdateCheck { get; set; } = true;
}

[JsonSerializable(typeof(UpdaterSettings))]
[JsonSourceGenerationOptions(
    GenerationMode = JsonSourceGenerationMode.Default,
    PropertyNamingPolicy = JsonKnownNamingPolicy.Unspecified,
    WriteIndented = true,
    DefaultIgnoreCondition = JsonIgnoreCondition.Never)]
internal partial class UpdaterSettingsContext : JsonSerializerContext
{

}
