namespace StellaOps.Feedser.Source.Ghsa.Internal;

internal sealed record GhsaRecordDto
{
    public string GhsaId { get; init; } = string.Empty;

    public string? Summary { get; init; }

    public string? Description { get; init; }

    public string? Severity { get; init; }

    public DateTimeOffset? PublishedAt { get; init; }

    public DateTimeOffset? UpdatedAt { get; init; }

    public IReadOnlyList<string> Aliases { get; init; } = Array.Empty<string>();

    public IReadOnlyList<GhsaReferenceDto> References { get; init; } = Array.Empty<GhsaReferenceDto>();

    public IReadOnlyList<GhsaAffectedDto> Affected { get; init; } = Array.Empty<GhsaAffectedDto>();

    public IReadOnlyList<GhsaCreditDto> Credits { get; init; } = Array.Empty<GhsaCreditDto>();

    public IReadOnlyList<GhsaWeaknessDto> Cwes { get; init; } = Array.Empty<GhsaWeaknessDto>();

    public GhsaCvssDto? Cvss { get; init; }
}

internal sealed record GhsaReferenceDto
{
    public string Url { get; init; } = string.Empty;

    public string? Type { get; init; }

    public string? Name { get; init; }
}

internal sealed record GhsaAffectedDto
{
    public string PackageName { get; init; } = string.Empty;

    public string Ecosystem { get; init; } = string.Empty;

    public string? VulnerableRange { get; init; }

    public string? PatchedVersion { get; init; }
}

internal sealed record GhsaCreditDto
{
    public string? Type { get; init; }

    public string? Name { get; init; }

    public string? Login { get; init; }

    public string? ProfileUrl { get; init; }
}

internal sealed record GhsaWeaknessDto
{
    public string? CweId { get; init; }

    public string? Name { get; init; }
}

internal sealed record GhsaCvssDto
{
    public double? Score { get; init; }

    public string? VectorString { get; init; }

    public string? Severity { get; init; }
}
