namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
///
/// Append-only audit log for every config write + authorization-check event. Grants revoked for
/// UPDATE / DELETE on all principals (enforced by the authorization migration in B.3).
///
public sealed class ConfigAuditLog
{
public long AuditId { get; set; }
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
public required string Principal { get; set; }
/// DraftCreated | DraftEdited | Published | RolledBack | NodeApplied | CredentialAdded | CredentialDisabled | ClusterCreated | NodeAdded | ExternalIdReleased | CrossClusterNamespaceAttempt | OpcUaAccessDenied | …
public required string EventType { get; set; }
public string? ClusterId { get; set; }
public string? NodeId { get; set; }
public long? GenerationId { get; set; }
public string? DetailsJson { get; set; }
///
/// Stable per-event identifier from AuditEvent.EventId. Filtered unique index on
/// this column gives cross-restart idempotency for the batched AuditWriterActor: a flush
/// that retries after a process crash can re-send the same EventId without producing a
/// duplicate row. Nullable so pre-v2 rows backfill cleanly.
///
public Guid? EventId { get; set; }
/// Correlation ID from AuditEvent.CorrelationId so an audit row joins to its
/// originating request/workflow. Nullable for the same backfill reason as .
public Guid? CorrelationId { get; set; }
}