using System.ComponentModel.DataAnnotations;
namespace GerbilManagerWebAPI.Models
{
///
/// VERIFIED/PROTECTED OVERRIDE: authoritative, hand-curated per-gerbil field values. Decoupled
/// from the rest of the model on purpose — is a plain Guid column (NOT an
/// enforced foreign key, no navigation property), so the import re-ingest wipe
/// (IngestResolvedService) can delete and reload gerbils without deleting or breaking
/// override rows. After every ingest the override is re-applied on top of the fresh import (the
/// "freeze"), so the breeder's curated values are never lost. Matched to the (deterministic)
/// gerbil id. Same ingest-surviving pattern as .
///
/// Two flavours, both stored here:
/// - = true → "vollständig korrekt": the whole own-field freeze set is
/// pinned, and a full Akte snapshot () is kept for the drift report,
/// export and regression test.
/// - = false → "geschützt": created by a manual edit; only the changed
/// fields are pinned (per-field) so untouched fields keep receiving import improvements.
///
public class GerbilOverride
{
[Key]
public Guid Id { get; set; }
/// Loose reference (no FK) to the gerbil this override curates.
public Guid GerbilId { get; set; }
/// Captured gerbil name — keeps the row human-readable and survives an ingest wipe.
public string? EntityName { get; set; }
/// true = "vollständig korrekt" (full freeze + certified); false = "geschützt" (per-field edit).
public bool IsVerified { get; set; }
/// Frozen own-field values as a JSON object (field name → value). Verified rows carry
/// the full freeze set; protected rows carry only the manually-changed fields. Re-applied on
/// top of the fresh import after every ingest.
public required string OverrideJson { get; set; }
/// Full human-readable Akte snapshot (self + parents + own litters/children) captured
/// at verify time — feeds the drift report, export and regression test. null for protected-only rows.
public string? SnapshotJson { get; set; }
/// Raw-import Akte snapshot captured during the LAST ingest, BEFORE the freeze was
/// applied — lets the UI show where the raw import disagrees with the golden state. null until
/// the first ingest after verifying.
public string? LastImportSnapshotJson { get; set; }
/// Cached diff (golden ↔ last raw import) as a JSON array, computed at ingest time.
/// null/empty = no drift / not yet computed.
public string? LastImportDiffJson { get; set; }
/// Optional free-text note the breeder attached when verifying.
public string? Note { get; set; }
/// When the row was marked "vollständig korrekt"; null for protected-only rows.
public DateTimeOffset? VerifiedAt { get; set; }
/// When the override was last created/updated.
public DateTimeOffset UpdatedAt { get; set; }
}
}