using System.Text.Json;

namespace SilverOS.Welcome.Core.Apps;

public sealed record AppSource
{
    public string? Winget { get; init; }
    // Future: public string? Mirror { get; init; }  // swappable to a curated mirror.
}

public sealed record AppCatalogEntry
{
    public string Id { get; init; } = "";
    public string Name { get; init; } = "";
    public string Description { get; init; } = "";
    public AppSource Source { get; init; } = new();
    public string Group { get; init; } = "";
    public IReadOnlyList<string> Roles { get; init; } = Array.Empty<string>();
    public IReadOnlyList<string> DefaultFor { get; init; } = Array.Empty<string>();
    public string? Configure { get; init; }

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