using System;

namespace StabilityMatrix.Core.Models.Packages;

/// <summary>
/// Represents a security vulnerability in a package
/// </summary>
public class PackageVulnerability
{
    /// <summary>
    /// Unique identifier for the vulnerability (e.g. CVE number)
    /// </summary>
    public string Id { get; set; } = string.Empty;

    /// <summary>
    /// Short title describing the vulnerability
    /// </summary>
    public string Title { get; set; } = string.Empty;

    /// <summary>
    /// Detailed description of the vulnerability
    /// </summary>
    public string Description { get; set; } = string.Empty;

    /// <summary>
    /// URL with more information about the vulnerability
    /// </summary>
    public Uri? InfoUrl { get; set; }

    /// <summary>
    /// Severity level of the vulnerability
    /// </summary>
    public VulnerabilitySeverity Severity { get; set; }

    /// <summary>
    /// When this vulnerability was discovered/published
    /// </summary>
    public DateTimeOffset PublishedDate { get; set; }

    /// <summary>
    /// Version ranges affected by this vulnerability
    /// </summary>
    public string[] AffectedVersions { get; set; } = Array.Empty<string>();

    /// <summary>
    /// Version that fixes this vulnerability, if available
    /// </summary>
    public string? FixedInVersion { get; set; }
}

/// <summary>
/// Severity levels for package vulnerabilities
/// </summary>
public enum VulnerabilitySeverity
{
    Low,
    Medium,
    High,
    Critical
}
