using System.Text.Json.Serialization;
namespace AIStudio.AIOperations.PluginAudit;
///
/// Represents a single structured security finding produced by the security audit of a plugin.
///
public sealed class PluginAuditFinding
{
#pragma warning disable MWAIS0005
///
/// Gets the normalized internal severity level derived from .
///
#pragma warning restore MWAIS0005
[JsonIgnore]
public PluginAuditLevel Severity { get; private set; } = PluginAuditLevel.UNKNOWN;
///
/// Gets or sets the JSON-facing severity label used by the audit model response.
///
[JsonPropertyName("severity")]
public string SeverityText
{
get => this.Severity switch
{
PluginAuditLevel.DANGEROUS => "critical",
PluginAuditLevel.CAUTION => "medium",
PluginAuditLevel.SAFE => "low",
_ => "unknown",
};
set => this.Severity = value.Trim().ToLowerInvariant() switch
{
"critical" => PluginAuditLevel.DANGEROUS,
"medium" => PluginAuditLevel.CAUTION,
"low" => PluginAuditLevel.SAFE,
_ => PluginAuditLevel.UNKNOWN,
};
}
public string Category { get; set; } = string.Empty;
public string Location { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
}