using System;
using System.Collections.Generic;

namespace StellaOps.Feedser.Source.CertCc.Internal;

internal sealed record CertCcNoteDto(
    CertCcNoteMetadata Metadata,
    IReadOnlyList<CertCcVendorDto> Vendors,
    IReadOnlyList<CertCcVendorStatusDto> VendorStatuses,
    IReadOnlyList<CertCcVulnerabilityDto> Vulnerabilities)
{
    public static CertCcNoteDto Empty { get; } = new(
        CertCcNoteMetadata.Empty,
        Array.Empty<CertCcVendorDto>(),
        Array.Empty<CertCcVendorStatusDto>(),
        Array.Empty<CertCcVulnerabilityDto>());
}

internal sealed record CertCcNoteMetadata(
    string? VuId,
    string IdNumber,
    string Title,
    string? Overview,
    string? Summary,
    DateTimeOffset? Published,
    DateTimeOffset? Updated,
    DateTimeOffset? Created,
    int? Revision,
    IReadOnlyList<string> CveIds,
    IReadOnlyList<string> PublicUrls,
    string? PrimaryUrl)
{
    public static CertCcNoteMetadata Empty { get; } = new(
        VuId: null,
        IdNumber: string.Empty,
        Title: string.Empty,
        Overview: null,
        Summary: null,
        Published: null,
        Updated: null,
        Created: null,
        Revision: null,
        CveIds: Array.Empty<string>(),
        PublicUrls: Array.Empty<string>(),
        PrimaryUrl: null);
}

internal sealed record CertCcVendorDto(
    string Vendor,
    DateTimeOffset? ContactDate,
    DateTimeOffset? StatementDate,
    DateTimeOffset? Updated,
    string? Statement,
    string? Addendum,
    IReadOnlyList<string> References)
{
    public static CertCcVendorDto Empty { get; } = new(
        Vendor: string.Empty,
        ContactDate: null,
        StatementDate: null,
        Updated: null,
        Statement: null,
        Addendum: null,
        References: Array.Empty<string>());
}

internal sealed record CertCcVendorStatusDto(
    string Vendor,
    string CveId,
    string Status,
    string? Statement,
    IReadOnlyList<string> References,
    DateTimeOffset? DateAdded,
    DateTimeOffset? DateUpdated)
{
    public static CertCcVendorStatusDto Empty { get; } = new(
        Vendor: string.Empty,
        CveId: string.Empty,
        Status: string.Empty,
        Statement: null,
        References: Array.Empty<string>(),
        DateAdded: null,
        DateUpdated: null);
}

internal sealed record CertCcVulnerabilityDto(
    string CveId,
    string? Description,
    DateTimeOffset? DateAdded,
    DateTimeOffset? DateUpdated)
{
    public static CertCcVulnerabilityDto Empty { get; } = new(
        CveId: string.Empty,
        Description: null,
        DateAdded: null,
        DateUpdated: null);
}
