2024-04-18 01:44:37 +02:00
|
|
|
using System;
|
|
|
|
|
using SQLite;
|
2024-11-10 23:28:25 +01:00
|
|
|
using Wino.Core.Domain.Entities.Mail;
|
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.Entities.Shared;
|
|
|
|
|
|
|
|
|
|
public class MailAccount
|
2024-04-18 01:44:37 +02:00
|
|
|
{
|
2025-02-16 11:54:23 +01:00
|
|
|
[PrimaryKey]
|
|
|
|
|
public Guid Id { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Given name of the account in Wino.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// TODO: Display name of the authenticated user/account.
|
|
|
|
|
/// API integrations will query this value from the API.
|
|
|
|
|
/// IMAP is populated by user on setup dialog.
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
|
|
public string SenderName { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Account e-mail address.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Address { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provider type of the account. Outlook,Gmail etc...
|
|
|
|
|
/// </summary>
|
|
|
|
|
public MailProviderType ProviderType { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// For tracking mail change delta.
|
|
|
|
|
/// Gmail : historyId
|
|
|
|
|
/// Outlook: deltaToken
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string SynchronizationDeltaIdentifier { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// For tracking calendar change delta.
|
|
|
|
|
/// Gmail: It's per-calendar, so unused.
|
|
|
|
|
/// Outlook: deltaLink
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string CalendarSynchronizationDeltaIdentifier { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// TODO: Gets or sets the custom account identifier color in hex.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string AccountColorHex { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Base64 encoded profile picture of the account.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Base64ProfilePictureData { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the listing order of the account in the accounts list.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Order { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets whether the account has any reason for an interactive user action to fix continue operating.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public AccountAttentionReason AttentionReason { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the id of the merged inbox this account belongs to.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Guid? MergedInboxId { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the additional IMAP provider assignment for the account.
|
|
|
|
|
/// Providers that use IMAP as a synchronizer but have special requirements.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public SpecialImapProvider SpecialImapProvider { get; set; }
|
2026-01-05 00:21:07 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets whether calendar access is granted for this account.
|
|
|
|
|
/// When false, synchronizers will not process EventMessages or calendar invitations.
|
|
|
|
|
/// Default is false for existing accounts to prevent scope issues.
|
|
|
|
|
/// New accounts created after this feature will have this set to true.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsCalendarAccessGranted { get; set; }
|
2025-02-16 11:54:23 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Contains the merged inbox this account belongs to.
|
|
|
|
|
/// Ignored for all SQLite operations.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Ignore]
|
|
|
|
|
public MergedInbox MergedInbox { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Populated only when account has custom server information.
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
|
|
[Ignore]
|
|
|
|
|
public CustomServerInformation ServerInformation { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Account preferences.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Ignore]
|
|
|
|
|
public MailAccountPreferences Preferences { get; set; }
|
|
|
|
|
|
2026-02-06 01:18:12 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Last time folder structure was synchronized.
|
|
|
|
|
/// Used for optimization - skip folder sync if synced recently.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DateTime? LastFolderStructureSyncDate { get; set; }
|
|
|
|
|
|
2026-04-14 00:03:48 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets when the account was created in Wino.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DateTime? CreatedAt { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the timespan used for the account's initial mail synchronization.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public InitialSynchronizationRange InitialSynchronizationRange { get; set; } = InitialSynchronizationRange.SixMonths;
|
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets whether the account can perform ProfileInformation sync type.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsProfileInfoSyncSupported => ProviderType == MailProviderType.Outlook || ProviderType == MailProviderType.Gmail;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets whether the account can perform AliasInformation sync type.
|
|
|
|
|
/// </summary>
|
2026-04-13 01:09:40 +02:00
|
|
|
public bool IsAliasSyncSupported => ProviderType == MailProviderType.Gmail || ProviderType == MailProviderType.Outlook;
|
2025-12-30 10:36:27 +01:00
|
|
|
|
2026-04-15 01:18:07 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets whether the account can perform category definition sync type.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsCategorySyncSupported => ProviderType == MailProviderType.Outlook;
|
|
|
|
|
|
2025-12-30 10:36:27 +01:00
|
|
|
public override string ToString() => Name;
|
2024-04-18 01:44:37 +02:00
|
|
|
}
|