using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; namespace Nuuru.Server.Models { public enum NotificationType { CommentOnPost = 0, Mention = 1, SystemAnnouncement = 2, PostApproved = 3, PostRejected = 4, ReportResolved = 5, ReportDismissed = 6, PrivateMessage = 7, WatchedPostComment = 8, WatchedThreadReply = 9, PostTrashed = 10, PostRestored = 11, ForumQuote = 12, Reaction = 13, GroupMessage = 14, FriendAdded = 15, EnemyAdded = 16, FriendRemoved = 17 } [Index(nameof(UserId), nameof(IsRead))] public class Notification { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid Id { get; set; } = Guid.NewGuid(); [Required] public NotificationType Type { get; set; } [Required] [MaxLength(500)] public string Message { get; set; } = string.Empty; public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public bool IsRead { get; set; } = false; // Related entity IDs for navigation public int? RelatedPostId { get; set; } // Booru post public int? RelatedCommentId { get; set; } // Booru comment public int? RelatedForumPostId { get; set; } // Forum post public int? RelatedForumThreadId { get; set; } // Forum thread (for watch notifications) [MaxLength(100)] public string? RelatedForumCategorySlug { get; set; } // Forum category slug (for building URLs) public Guid? RelatedConversationId { get; set; } // Private message conversation public int? RelatedMessageId { get; set; } // Private message // Reaction emote name (for reaction notifications) [MaxLength(32)] public string? ReactionEmoteName { get; set; } // User who triggered the notification (null for system announcements) public Guid? TriggeredByUserId { get; set; } public ApplicationUser? TriggeredByUser { get; set; } // User receiving the notification public Guid UserId { get; set; } public ApplicationUser User { get; set; } = null!; } }