using System.Collections.Immutable;

namespace StellaOps.Feedser.Source.Jvn.Internal;

internal sealed record JvnDetailDto(
    string VulnerabilityId,
    string Title,
    string? Overview,
    string? Language,
    DateTimeOffset? DateFirstPublished,
    DateTimeOffset? DateLastUpdated,
    DateTimeOffset? DatePublic,
    ImmutableArray<JvnCvssDto> Cvss,
    ImmutableArray<JvnAffectedProductDto> Affected,
    ImmutableArray<JvnReferenceDto> References,
    ImmutableArray<JvnHistoryEntryDto> History,
    ImmutableArray<string> CweIds,
    ImmutableArray<string> CveIds,
    string? AdvisoryUrl,
    string? JvnCategory,
    ImmutableArray<string> VendorStatuses)
{
    public static JvnDetailDto Empty { get; } = new(
        "unknown",
        "unknown",
        null,
        null,
        null,
        null,
        null,
        ImmutableArray<JvnCvssDto>.Empty,
        ImmutableArray<JvnAffectedProductDto>.Empty,
        ImmutableArray<JvnReferenceDto>.Empty,
        ImmutableArray<JvnHistoryEntryDto>.Empty,
        ImmutableArray<string>.Empty,
        ImmutableArray<string>.Empty,
        null,
        null,
        ImmutableArray<string>.Empty);
}

internal sealed record JvnCvssDto(
    string Version,
    string Type,
    string Severity,
    double Score,
    string? Vector);

internal sealed record JvnAffectedProductDto(
    string? Vendor,
    string? Product,
    string? Cpe,
    string? CpeVendor,
    string? CpeProduct,
    string? Version,
    string? Build,
    string? Description,
    string? Status);

internal sealed record JvnReferenceDto(
    string Type,
    string Id,
    string? Name,
    string Url);

internal sealed record JvnHistoryEntryDto(
    string? Number,
    DateTimeOffset? Timestamp,
    string? Description);
