namespace Heimdall.Domain.Entities; /// /// Append-only audit log for security-relevant actions. /// DB-level INSERT-only trigger recommended in production. /// public class AuditLog { public Guid Id { get; private set; } = Guid.NewGuid(); public Guid? UserId { get; private set; } public string Action { get; private set; } = string.Empty; public string ResourceType { get; private set; } = string.Empty; public string? ResourceId { get; private set; } public string? OldValue { get; private set; } public string? NewValue { get; private set; } public string? IpAddress { get; private set; } public DateTime Timestamp { get; private set; } = DateTime.UtcNow; // Navigation public AppUser? User { get; private set; } private AuditLog() { } // EF Core public AuditLog( Guid? userId, string action, string resourceType, string? resourceId = null, string? oldValue = null, string? newValue = null, string? ipAddress = null) { UserId = userId; Action = action; ResourceType = resourceType; ResourceId = resourceId; OldValue = oldValue; NewValue = newValue; IpAddress = ipAddress; } }