using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace StellaOps.Scanner.Triage.Entities; /// /// Immutable snapshot record for Smart-Diff, capturing input/output changes. /// [Table("triage_snapshot")] public sealed class TriageSnapshot { /// /// Unique identifier. /// [Key] [Column("id")] public Guid Id { get; init; } = Guid.NewGuid(); /// /// The finding this snapshot applies to. /// [Column("finding_id")] public Guid FindingId { get; init; } /// /// What triggered this snapshot. /// [Column("trigger")] public TriageSnapshotTrigger Trigger { get; init; } /// /// Previous inputs hash (null for first snapshot). /// [Column("from_inputs_hash")] public string? FromInputsHash { get; init; } /// /// New inputs hash. /// [Required] [Column("to_inputs_hash")] public required string ToInputsHash { get; init; } /// /// Human-readable summary of what changed. /// [Required] [Column("summary")] public required string Summary { get; init; } /// /// Precomputed diff in JSON format (optional). /// [Column("diff_json", TypeName = "jsonb")] public string? DiffJson { get; init; } /// /// When this snapshot was created. /// [Column("created_at")] public DateTimeOffset CreatedAt { get; init; } = DateTimeOffset.UtcNow; // Navigation property [ForeignKey(nameof(FindingId))] public TriageFinding? Finding { get; init; } }