namespace MailSharp.MailClient.Models; public enum FolderSyncMode { NotSynchronized, NewHeaders, AllHeaders, NewMessages, AllMessages, Direct } // Per-account override of a folder's sync mode/subscription, keyed by (account, folder full // name) - see IFolderSettingsStore. Not stored on MailFolder itself since MailFolder is rebuilt // fresh from IMAP on every fetch. public class FolderSetting { public string Id { get; set; } = ""; public FolderSyncMode SyncMode { get; set; } = FolderSyncMode.Direct; public bool Subscribed { get; set; } = true; } // Display-only ordering of an account's folders in the main menu (Settings > Mappen beheren) - // see IFolderSettingsStore.GetOrder/SaveOrder. Never affects the real IMAP folder structure. public class FolderOrder { public int Id { get; set; } public List Names { get; set; } = []; } public class MailFolder { public string FullName { get; set; } = ""; public string DisplayName { get; set; } = ""; public int UnreadCount { get; set; } public bool IsSelectable { get; set; } = true; // Folder-management-page fields (see Settings > Mappen beheren). MessageCount comes cheaply // from the IMAP STATUS/SELECT response already fetched for UnreadCount. SizeBytes is a // best-effort estimate, not an exact total - see IImapService.GetFoldersAsync for how it's // derived (real IMAP STATUS SIZE where the server supports it, otherwise summed from // whatever of the folder's messages happen to already be in the local message-list cache). // IsSizeEstimated tells the UI which case applied, so it can show e.g. "~" for the estimate. public int MessageCount { get; set; } public long SizeBytes { get; set; } public bool IsSizeEstimated { get; set; } public int Depth { get; set; } public FolderSyncMode SyncMode { get; set; } = FolderSyncMode.Direct; public bool Subscribed { get; set; } = true; // INBOX, and the folders serving IMAP's other special roles (Sent/Trash/Drafts/Junk) - these // can't be deleted (see IImapService.DeleteFoldersAsync) since core app features (send, // delete-to-trash, save-draft, contacts' "sent" scan) assume they exist. public bool IsProtected { get; set; } } public class MessageListItem { public uint Uid { get; set; } public string Subject { get; set; } = ""; public string From { get; set; } = ""; public DateTimeOffset Date { get; set; } public long SizeBytes { get; set; } public bool IsRead { get; set; } public bool IsFlagged { get; set; } public bool HasAttachments { get; set; } public MessagePriority Priority { get; set; } = MessagePriority.Normal; public double SizeKb => Math.Round(SizeBytes / 1024.0, 1); } public class MessageDetail { public uint Uid { get; set; } public string Subject { get; set; } = ""; public string From { get; set; } = ""; public string SenderEmail { get; set; } = ""; public string To { get; set; } = ""; public string Cc { get; set; } = ""; public DateTimeOffset Date { get; set; } public string HtmlBody { get; set; } = ""; public string TextBody { get; set; } = ""; public List Attachments { get; set; } = []; public bool HasExternalImages { get; set; } public bool ImagesAllowed { get; set; } public MessagePriority Priority { get; set; } = MessagePriority.Normal; public MessageSensitivity Sensitivity { get; set; } = MessageSensitivity.Nothing; // The folder's unread count immediately after this message got marked read (from the local // index, which GetMessageAsync already just updated) - lets the client patch its folder sidebar // badge for free instead of re-fetching every folder's live IMAP STATUS just to refresh one // number. Null for folders that aren't indexed (NotSynchronized), where there's no local count // to report and the client should leave the badge alone. public int? FolderUnreadCount { get; set; } } public class AttachmentInfo { public string FileName { get; set; } = ""; public string ContentType { get; set; } = "application/octet-stream"; public long SizeBytes { get; set; } public int PartIndex { get; set; } } public class ContactAddress { public string Email { get; set; } = ""; public string Name { get; set; } = ""; } public class MessageSearchResult { public string Folder { get; set; } = ""; public uint Uid { get; set; } public string Subject { get; set; } = ""; public string From { get; set; } = ""; public DateTimeOffset Date { get; set; } } public class ComposeModel { public int AccountId { get; set; } public string To { get; set; } = ""; public string Cc { get; set; } = ""; public string Bcc { get; set; } = ""; public string Subject { get; set; } = ""; public string HtmlBody { get; set; } = ""; public MessagePriority Priority { get; set; } = MessagePriority.Normal; public MessageSensitivity Sensitivity { get; set; } = MessageSensitivity.Nothing; public bool RequestReadReceipt { get; set; } }