using System.Text.Json;
using System.Text.Json.Serialization;

namespace SilverOS.Welcome.Core.Flavours;

public sealed record FlavourManifest
{
    public string Id { get; init; } = "";
    public string Label { get; init; } = "";
    public string Description { get; init; } = "";
    public bool IsDefault { get; init; }
    public HardeningSpec Hardening { get; init; } = new();
    public IReadOnlyList<string> AppSet { get; init; } = Array.Empty<string>();
    public IReadOnlyDictionary<string, JsonElement> Settings { get; init; }
        = new Dictionary<string, JsonElement>();

    public static readonly JsonSerializerOptions JsonOptions = new()
    {
        PropertyNameCaseInsensitive = true,
        ReadCommentHandling = JsonCommentHandling.Skip,
        AllowTrailingCommas = true
    };
}

public sealed record HardeningSpec
{
    public IReadOnlyList<string> Modules { get; init; } = Array.Empty<string>();
    public IReadOnlyDictionary<string, string> Params { get; init; }
        = new Dictionary<string, string>();
}
