using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace StellaOps.Feedser.Source.Vndr.Vmware.Internal;

internal sealed record VmwareDetailDto
{
    [JsonPropertyName("id")]
    public string AdvisoryId { get; init; } = string.Empty;

    [JsonPropertyName("title")]
    public string Title { get; init; } = string.Empty;

    [JsonPropertyName("summary")]
    public string? Summary { get; init; }

    [JsonPropertyName("published")]
    public DateTimeOffset? Published { get; init; }

    [JsonPropertyName("modified")]
    public DateTimeOffset? Modified { get; init; }

    [JsonPropertyName("cves")]
    public IReadOnlyList<string>? CveIds { get; init; }

    [JsonPropertyName("affected")]
    public IReadOnlyList<VmwareAffectedProductDto>? Affected { get; init; }

    [JsonPropertyName("references")]
    public IReadOnlyList<VmwareReferenceDto>? References { get; init; }
}

internal sealed record VmwareAffectedProductDto
{
    [JsonPropertyName("product")]
    public string Product { get; init; } = string.Empty;

    [JsonPropertyName("version")]
    public string? Version { get; init; }

    [JsonPropertyName("fixedVersion")]
    public string? FixedVersion { get; init; }
}

internal sealed record VmwareReferenceDto
{
    [JsonPropertyName("type")]
    public string? Type { get; init; }

    [JsonPropertyName("url")]
    public string Url { get; init; } = string.Empty;
}
