using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace DigitalData.MessagingService.Domain.Entities; /// /// DTO for a single email account configuration. /// [Table("EMAIL_ACCOUNT")] public class EmailAccount { /// /// Logical name to identify this account (e.g. "default", "support"). /// [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Column("ID", TypeName = "int")] public int Id { get; set; } [Required] [MaxLength(256)] [Column("USERNAME", TypeName = "nvarchar(256)")] #if NET public required string Username { get; set; } #else public string Username { get; set; } = null!; #endif [Required] [MaxLength(512)] [Column("PASSWORD", TypeName = "nvarchar(512)")] #if NET public required string Password { get; set; } #else public string Password { get; set; } = null!; #endif [Required] [MaxLength(256)] [Column("SMTP_SERVER", TypeName = "nvarchar(256)")] #if NET public required string SmtpServer { get; set; } #else public string SmtpServer { get; set; } = null!; #endif [Column("SMTP_PORT", TypeName = "int")] public int SmtpPort { get; set; } [Column("SMTP_USE_SSL", TypeName = "bit")] public bool SmtpUseSsl { get; set; } [Column("USE_OAUTH2", TypeName = "bit")] public bool UseOAuth2 { get; set; } /// /// IMAP server hostname (e.g. "imap.example.com"). /// Leave empty when this account is send-only. /// [MaxLength(256)] [Column("IMAP_SERVER", TypeName = "nvarchar(256)")] public string? ImapServer { get; set; } /// /// IMAP server port (993 for SSL, 143 for plain/STARTTLS). /// [Column("IMAP_PORT", TypeName = "int")] public int ImapPort { get; set; } = 993; /// /// Use SSL/TLS when connecting to the IMAP server. /// [Column("IMAP_USE_SSL", TypeName = "bit")] public bool ImapUseSsl { get; set; } = true; }