2024-04-18 01:44:37 +02:00
|
|
|
|
using System.Collections.Generic;
|
2024-11-10 23:28:25 +01:00
|
|
|
|
using Wino.Core.Domain.Entities.Shared;
|
2024-04-18 01:44:37 +02:00
|
|
|
|
using Wino.Core.Domain.Enums;
|
|
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
namespace Wino.Core.Domain.Models.Folders;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Grouped folder information for the menu for given account.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class AccountFolderTree
|
2024-04-18 01:44:37 +02:00
|
|
|
|
{
|
2025-02-16 11:54:23 +01:00
|
|
|
|
public MailAccount Account { get; }
|
|
|
|
|
|
public List<IMailItemFolder> Folders { get; set; } = new List<IMailItemFolder>();
|
2024-04-18 01:44:37 +02:00
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
public AccountFolderTree(MailAccount account)
|
|
|
|
|
|
{
|
|
|
|
|
|
Account = account;
|
|
|
|
|
|
}
|
2025-02-16 11:35:43 +01:00
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
public bool HasSpecialTypeFolder(SpecialFolderType type)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var folderStructure in Folders)
|
2025-02-16 11:43:30 +01:00
|
|
|
|
{
|
2025-02-16 11:54:23 +01:00
|
|
|
|
bool hasSpecialFolder = folderStructure.ContainsSpecialFolderType(type);
|
2025-02-16 11:43:30 +01:00
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
if (hasSpecialFolder)
|
|
|
|
|
|
return true;
|
2025-02-16 11:43:30 +01:00
|
|
|
|
}
|
2025-02-16 11:54:23 +01:00
|
|
|
|
|
|
|
|
|
|
return false;
|
2024-04-18 01:44:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|