using System; using System.Collections.Generic; using System.Threading.Tasks; using MimeKit; using Wino.Core.Domain.Entities; using Wino.Core.Domain.Models.MailItem; namespace Wino.Core.Domain.Interfaces { public interface IMailService { Task GetSingleMailItemAsync(string mailCopyId, string remoteFolderId); Task GetSingleMailItemAsync(Guid uniqueMailId); Task CreateDraftAsync(MailAccount composerAccount, MimeMessage generatedReplyMime, MimeMessage replyingMimeMessage = null, IMailItem replyingMailItem = null); Task> FetchMailsAsync(MailListInitializationOptions options); Task> GetMailIdsByFolderIdAsync(Guid folderId); // v2 /// /// Deletes all mail copies for all folders. /// /// Account to remove from /// Mail copy id to remove. Task DeleteMailAsync(Guid accountId, string mailCopyId); Task ChangeReadStatusAsync(string mailCopyId, bool isRead); Task ChangeFlagStatusAsync(string mailCopyId, bool isFlagged); Task CreateAssignmentAsync(Guid accountId, string mailCopyId, string remoteFolderId); Task DeleteAssignmentAsync(Guid accountId, string mailCopyId, string remoteFolderId); Task CreateMailAsync(Guid accountId, NewMailItemPackage package); /// /// Maps new mail item with the existing local draft copy. /// In case of failure, it returns false. /// Then synchronizers must insert a new mail item. /// /// Id of the account. It's important to map to the account since if the user use the same account with different providers, this call must map the correct one. /// UniqueId of the local draft copy. /// New assigned remote mail item id. /// New assigned draft id if exists. /// New message's thread/conversation id. /// True if mapping is done. False if local copy doesn't exists. Task MapLocalDraftAsync(Guid accountId, Guid localDraftCopyUniqueId, string newMailCopyId, string newDraftId, string newThreadId); /// /// Maps new mail item with the existing local draft copy. /// /// /// /// /// Task MapLocalDraftAsync(string newMailCopyId, string newDraftId, string newThreadId); Task CreateDraftMimeMessageAsync(Guid accountId, DraftCreationOptions options); Task UpdateMailAsync(MailCopy mailCopy); /// /// Gets the new inserted unread mails after the synchronization. /// /// Account id. /// /// Mail ids that synchronizer tried to download. If there was an issue with the /// Items that tried and actually downloaded may differ. This function will return only new inserted ones. /// /// Newly inserted unread mails inside the Inbox folder. Task> GetDownloadedUnreadMailsAsync(Guid accountId, IEnumerable downloadedMailCopyIds); /// /// Returns the account that this mail copy unique id is assigned. /// Used in toast notification handler. /// /// Unique id of the mail item. /// Account that mail belongs to. Task GetMailAccountByUniqueIdAsync(Guid uniqueMailId); /// /// Checks whether the given mail copy id exists in the database. /// Safely used for Outlook to prevent downloading the same mail twice. /// For Gmail, it should be avoided since one mail may belong to multiple folders. /// /// Native mail id of the message. Task IsMailExistsAsync(string mailCopyId); } }