using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace StellaOps.Scanner.Triage.Entities;
///
/// Represents a scan that produced triage findings.
///
[Table("triage_scan")]
public sealed class TriageScan
{
///
/// Unique identifier for the scan.
///
[Key]
[Column("id")]
public required Guid Id { get; init; }
///
/// Tenant that owns this scan.
///
[Required]
[Column("tenant_id")]
public required string TenantId { get; init; }
///
/// Image reference that was scanned.
///
[Required]
[Column("image_reference")]
public required string ImageReference { get; init; }
///
/// Image digest (sha256:...).
///
[Column("image_digest")]
public string? ImageDigest { get; init; }
///
/// Target digest for replay command generation.
///
[Column("target_digest")]
public string? TargetDigest { get; init; }
///
/// Target reference for replay command generation.
///
[Column("target_reference")]
public string? TargetReference { get; init; }
///
/// Knowledge snapshot ID used for this scan.
///
[Column("knowledge_snapshot_id")]
public string? KnowledgeSnapshotId { get; init; }
///
/// When the scan started.
///
[Column("started_at")]
public required DateTimeOffset StartedAt { get; init; }
///
/// When the scan completed.
///
[Column("completed_at")]
public DateTimeOffset? CompletedAt { get; set; }
///
/// Scan status (running, completed, failed).
///
[Required]
[Column("status")]
public required string Status { get; set; }
///
/// Policy file hash used during the scan.
///
[Column("policy_hash")]
public string? PolicyHash { get; init; }
///
/// Feed snapshot hash for deterministic replay.
///
[Column("feed_snapshot_hash")]
public string? FeedSnapshotHash { get; init; }
///
/// When the knowledge snapshot was created.
///
[Column("snapshot_created_at")]
public DateTimeOffset? SnapshotCreatedAt { get; init; }
///
/// Feed versions used in this scan (JSON dictionary).
///
[Column("feed_versions", TypeName = "jsonb")]
public Dictionary? FeedVersions { get; init; }
///
/// Content hash of the snapshot for verification.
///
[Column("snapshot_content_hash")]
public string? SnapshotContentHash { get; init; }
///
/// Final digest of the scan result for verification.
///
[Column("final_digest")]
public string? FinalDigest { get; init; }
///
/// Feed snapshot timestamp.
///
[Column("feed_snapshot_at")]
public DateTimeOffset? FeedSnapshotAt { get; init; }
///
/// Offline kit bundle ID if scan was done with offline kit.
///
[Column("offline_bundle_id")]
public string? OfflineBundleId { get; init; }
///
/// Navigation property to findings.
///
public ICollection Findings { get; init; } = new List();
}