namespace BulkArchiveMailer.Core { /// One editable Subject + BodyHtml pair. public sealed class MailTemplate { public string Subject { get; set; } = ""; public string BodyHtml { get; set; } = ""; } /// The two named template keys used throughout the tool (matches ArchiveKind, and the JSON config's "templates" object). public static class MailTemplateKeys { public const string SshAccess = "ssh_access"; public const string ConfigUpdate = "config_update"; public static string For(ArchiveKind kind) => kind == ArchiveKind.SshAccess ? SshAccess : ConfigUpdate; } /// Both named templates together, as used by ArchiveScanner to render a SendJob's Subject/BodyHtml. public sealed class MailTemplateSet { public MailTemplate SshAccess { get; set; } = new MailTemplate(); public MailTemplate ConfigUpdate { get; set; } = new MailTemplate(); public MailTemplate Get(ArchiveKind kind) => kind == ArchiveKind.SshAccess ? SshAccess : ConfigUpdate; /// /// The two templates as shipped in config.default.json (embedded /// resource), independent of anything the user has saved to /// %APPDATA%\BulkArchiveMailer\config.json. Mainly useful for a /// "reset to defaults" action in SettingsForm. /// public static MailTemplateSet LoadDefaults() => AppSettings.LoadDefaults().ToTemplateSet(); } }