using System; using System.Collections.Generic; using Wino.Core.Domain.Entities; using Wino.Core.Domain.Enums; using Wino.Core.Domain.Models.Folders; namespace Wino.Core.Domain.Models.MailItem { /// /// Encapsulates the options for preparing requests to execute mail operations for mail items like Move, Delete, MarkAsRead, etc. /// public class MailOperationPreperationRequest { public MailOperationPreperationRequest(MailOperation action, IEnumerable mailItems, bool toggleExecution = false, IMailItemFolder moveTargetFolder = null, bool ignoreHardDeleteProtection = false) { Action = action; MailItems = mailItems ?? throw new ArgumentNullException(nameof(mailItems)); ToggleExecution = toggleExecution; MoveTargetFolder = moveTargetFolder; IgnoreHardDeleteProtection = ignoreHardDeleteProtection; } public MailOperationPreperationRequest(MailOperation action, MailCopy singleMailItem, bool toggleExecution = false, IMailItemFolder moveTargetFolder = null, bool ignoreHardDeleteProtection = false) { Action = action; MailItems = new List() { singleMailItem }; ToggleExecution = toggleExecution; MoveTargetFolder = moveTargetFolder; IgnoreHardDeleteProtection = ignoreHardDeleteProtection; } /// /// Action to execute. /// public MailOperation Action { get; set; } /// /// Mail copies execute the action on. /// public IEnumerable MailItems { get; set; } /// /// Whether the operation can be reverted if needed. /// eg. MarkAsRead on already read item will set the action to MarkAsUnread. /// This is used in hover actions for example. /// public bool ToggleExecution { get; set; } /// /// Whether hard delete protection should be ignored. /// Discard draft requests for example should ignore hard delete protection. /// public bool IgnoreHardDeleteProtection { get; set; } /// /// Moving folder for the Move operation. /// If null and the action is Move, the user will be prompted to select a folder. /// public IMailItemFolder MoveTargetFolder { get; } } }