namespace SlpModularCms.Modules.Contact.Data.Entities; public enum ContactMessageStatus { New, Read, Archived, Spam, Converted, } public enum ContactMailStatus { /// Waiting to be mailed (also the state while no mail sender is available). Pending, Sent, Failed, /// Never mailed on purpose (spam). NotApplicable, } /// /// A message sent through the website's contact form. Has its own id and status so that it can /// later be turned into an assignment (quotes, invoices); that is not built yet. /// public class ContactMessage { public Guid Id { get; set; } public string SiteId { get; set; } = string.Empty; public DateTimeOffset ReceivedAt { get; set; } public string Name { get; set; } = string.Empty; public string Email { get; set; } = string.Empty; /// Opaque value chosen by the site (a package id, a slug, or 'other'). public string Subject { get; set; } = string.Empty; public string Message { get; set; } = string.Empty; public ContactMessageStatus Status { get; set; } public ContactMailStatus MailStatus { get; set; } /// Short error code of the last failed mail attempt (never an address or content). public string? MailError { get; set; } public int MailAttempts { get; set; } public DateTimeOffset? NextMailAttemptAt { get; set; } /// Fixed at insert: a later configuration change does not apply retroactively. public DateTimeOffset RetentionUntil { get; set; } } /// Remembers an Idempotency-Key for 24 hours. Holds no request content. public class IdempotencyRecord { public string SiteId { get; set; } = string.Empty; public Guid Key { get; set; } public DateTimeOffset CreatedAt { get; set; } public int StatusCode { get; set; } } /// /// The CMS-controlled on/off switch of the contact form (a singleton row, id 1). While no row /// exists the switch is off. It is the second layer of the gate; the host switch /// (Contact:Enabled) is the first. /// public class ContactSettings { public const int SingletonId = 1; public int Id { get; set; } = SingletonId; public bool Enabled { get; set; } public DateTimeOffset UpdatedAt { get; set; } public Guid UpdatedByUserId { get; set; } }