using System; using System.Collections.Generic; using SQLite; namespace Wino.Core.Domain.Entities.Shared; /// /// Back storage for simple name-address book. /// These values will be inserted during MIME fetch. /// // TODO: This can easily evolve to Contact store, just like People app in Windows 10/11. // Do it. public class AccountContact : IEquatable { /// /// E-mail address of the contact. /// [PrimaryKey] public string Address { get; set; } /// /// Display name of the contact. /// public string Name { get; set; } /// /// File ID for the contact picture stored on disk. /// The actual file lives at {ApplicationDataFolderPath}/contacts/{ContactPictureFileId}.jpg. /// Preferred over Base64ContactPicture — allows native BitmapImage file loading and avoids SQLite bloat. /// public Guid? ContactPictureFileId { get; set; } /// /// Legacy base64 encoded profile image of the contact. /// For user-set contact pictures: migrate to file storage via ContactPictureFileId instead. /// Still used for OAuth account profile pictures (MailAccount.Base64ProfilePictureData). /// public string Base64ContactPicture { get; set; } /// /// All registered accounts have their contacts registered as root. /// Root contacts must not be overridden by any configuration. /// They are created on account creation. /// public bool IsRootContact { get; set; } /// /// When true, indicates that the contact has been manually modified by the user. /// Contacts with this flag set to true should not be updated during synchronization. /// public bool IsOverridden { get; set; } = false; public override bool Equals(object obj) { return Equals(obj as AccountContact); } public bool Equals(AccountContact other) { return other is not null && Address == other.Address && Name == other.Name; } public override int GetHashCode() { return HashCode.Combine(Address, Name); } public static bool operator ==(AccountContact left, AccountContact right) { return EqualityComparer.Default.Equals(left, right); } public static bool operator !=(AccountContact left, AccountContact right) { return !(left == right); } }