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

namespace StellaOps.Feedser.Source.Kev.Internal;

internal sealed record KevCatalogDto
{
    [JsonPropertyName("title")]
    public string? Title { get; init; }

    [JsonPropertyName("catalogVersion")]
    public string? CatalogVersion { get; init; }

    [JsonPropertyName("dateReleased")]
    public DateTimeOffset? DateReleased { get; init; }

    [JsonPropertyName("count")]
    public int Count { get; init; }

    [JsonPropertyName("vulnerabilities")]
    public IReadOnlyList<KevVulnerabilityDto> Vulnerabilities { get; init; } = Array.Empty<KevVulnerabilityDto>();
}

internal sealed record KevVulnerabilityDto
{
    [JsonPropertyName("cveID")]
    public string? CveId { get; init; }

    [JsonPropertyName("vendorProject")]
    public string? VendorProject { get; init; }

    [JsonPropertyName("product")]
    public string? Product { get; init; }

    [JsonPropertyName("vulnerabilityName")]
    public string? VulnerabilityName { get; init; }

    [JsonPropertyName("dateAdded")]
    public string? DateAdded { get; init; }

    [JsonPropertyName("shortDescription")]
    public string? ShortDescription { get; init; }

    [JsonPropertyName("requiredAction")]
    public string? RequiredAction { get; init; }

    [JsonPropertyName("dueDate")]
    public string? DueDate { get; init; }

    [JsonPropertyName("knownRansomwareCampaignUse")]
    public string? KnownRansomwareCampaignUse { get; init; }

    [JsonPropertyName("notes")]
    public string? Notes { get; init; }

    [JsonPropertyName("cwes")]
    public IReadOnlyList<string> Cwes { get; init; } = Array.Empty<string>();
}
