namespace MailSharp.MailClient.Models; public class Account { public int Id { get; set; } public string DisplayName { get; set; } = ""; public string EmailAddress { get; set; } = ""; public string Username { get; set; } = ""; // Encrypted at rest via IPasswordProtector public string ProtectedPassword { get; set; } = ""; public string ImapHost { get; set; } = ""; public int ImapPort { get; set; } = 993; public SecurityMode ImapSecurity { get; set; } = SecurityMode.SslTls; public string SmtpHost { get; set; } = ""; public int SmtpPort { get; set; } = 587; public SecurityMode SmtpSecurity { get; set; } = SecurityMode.StartTls; // User-configurable preferences (Settings page). MessagesPerPage/ContactsPerPage of 0 means // "use the app-wide default" (see MailSettings) rather than a hardcoded per-account fallback. public string Signature { get; set; } = ""; public int MessagesPerPage { get; set; } public int ContactsPerPage { get; set; } public int AutoCheckIntervalMinutes { get; set; } = 5; // Stored as an IANA id (e.g. "Europe/Amsterdam") even on Windows, where TimeZoneInfo itself // natively uses Windows ids ("W. Europe Standard Time") - the browser's Intl API (used for all // client-side date formatting) only understands IANA ids, so converting once here means every // other call site can just pass this straight through instead of re-converting. public string TimeZoneId { get; set; } = ResolveDefaultTimeZoneId(); public string Language { get; set; } = "nl"; // Grants access to the Maintenance page (logs, background process status, message metrics). // The first account ever created on a fresh install becomes admin automatically (see // AuthApiController.Login); later accounts default to false and can only be promoted via the // claim-admin bootstrap endpoint while no admin exists yet, or by an existing admin afterwards. public bool IsAdmin { get; set; } private static string ResolveDefaultTimeZoneId() { var id = TimeZoneInfo.Local.Id; if (OperatingSystem.IsWindows() && TimeZoneInfo.TryConvertWindowsIdToIanaId(id, out var iana)) return iana; return id; } }