namespace MailSharp.MailClient.Models; // One row per message, kept up to date by IImapService.EnsureFolderIndexedAsync (full rebuild on // UIDVALIDITY change, incremental fetch of new UIDs, UID-diff reconciliation when the message // count doesn't match) - this is what GetMessagesAsync/GetFoldersAsync (sizes)/ // SearchByAddressAsync/GetSentContactsAsync read from instead of re-scanning IMAP live, for any // folder whose FolderSyncMode isn't NotSynchronized. public class IndexedMessage { public string Id { get; set; } = ""; public string Key { get; set; } = ""; public int AccountId { get; set; } public string Folder { get; set; } = ""; public uint Uid { get; set; } public string Subject { get; set; } = ""; public string From { get; set; } = ""; public string To { get; set; } = ""; public string Cc { 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; } // Per-(account, folder) sync checkpoint - see IImapService.EnsureFolderIndexedAsync. UidValidity // changing means the server considers the whole mailbox rebuilt (rare); UidNext advancing means // new mail arrived; MessageCount not matching the index's own row count is the cheap signal that // something was removed (deleted or moved elsewhere) since the last check. public class FolderSyncState { public string Id { get; set; } = ""; public uint UidValidity { get; set; } public uint UidNext { get; set; } public int MessageCount { get; set; } }