using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using eprintServer.Enums; using eprintServer.Entities; namespace eprintServer.Entities; [Table("notificationmodel")] public class NotificationModel { [Key] [Column("notificatoin_id")] public long Id { get; set; } public User Sender { get; set; } [Column("SenderId")] public long? SenderId { get; set; } public User Reciver { get; set; } [Column("ReciverId")] public long? ReciverId { get; set; } [Column("action")] public Action Action { get; set; } = Action.IDLE; [Column("action_id")] public long? ActionId { get; set; } [Column("subject")] public string Subject { get; set; } [Column("content")] public string Content { get; set; } [Column("logUrl")] public string LogUrl { get; set; } [Column("status")] public states Status { get; set; } = states.WAITING; [Column("timestmp")] public DateTime Timestmp { get; set; } public NotificationModel() { this.Timestmp = DateTime.UtcNow; } public Dictionary ToMap() { // Firebase Data dictionary values MUST be strings and MUST NOT be null. return new Dictionary { { "id", this.Id.ToString() }, { "sender", this.SenderId?.ToString() ?? "" }, { "reciver", this.ReciverId?.ToString() ?? "" }, { "actionId", this.ActionId?.ToString() ?? "" }, { "status", this.Status.ToString() }, { "subject", this.Subject ?? "" }, { "content", this.Content ?? "" }, { "action", this.Action.ToString() }, { "logoUrl", this.LogUrl ?? "" }, { "timestmp", this.Timestmp.ToString("o") } // "o" is standard ISO 8601 format }; } }