using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Nuuru.Server.Models { public class AuditLog { public const string TargetIdKey = "AuditLogTargetId"; public const string TargetTypeKey = "AuditLogTargetType"; public const string TargetCategoryKey = "AuditLogTargetCategory"; public const string ActionKey = "AuditLogAction"; public const string UserIdKey = "AuditLogUserId"; public const string AssessmentIdKey = "AuditLogAssessmentId"; public const string BrowserHashKey = "AuditLogBrowserHash"; [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid Id { get; set; } [Required] public string Action { get; set; } = string.Empty; [Required] public string Category { get; set; } = string.Empty; public string? TargetType { get; set; } public string? TargetId { get; set; } public string? IpAddress { get; set; } public Guid? AssessmentId { get; set; } public string? BrowserHash { get; set; } [Required] public string HttpMethod { get; set; } = string.Empty; [Required] public string RequestPath { get; set; } = string.Empty; public int ResponseStatusCode { get; set; } public DateTime Timestamp { get; set; } = DateTime.UtcNow; public Guid? UserId { get; set; } [ForeignKey(nameof(UserId))] public ApplicationUser? User { get; set; } } }