38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
namespace BulkArchiveMailer.Core
|
|
{
|
|
/// <summary>One editable Subject + BodyHtml pair.</summary>
|
|
public sealed class MailTemplate
|
|
{
|
|
public string Subject { get; set; } = "";
|
|
|
|
public string BodyHtml { get; set; } = "";
|
|
}
|
|
|
|
/// <summary>The two named template keys used throughout the tool (matches ArchiveKind, and the JSON config's "templates" object).</summary>
|
|
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;
|
|
}
|
|
|
|
/// <summary>Both named templates together, as used by ArchiveScanner to render a SendJob's Subject/BodyHtml.</summary>
|
|
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;
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
public static MailTemplateSet LoadDefaults() => AppSettings.LoadDefaults().ToTemplateSet();
|
|
}
|
|
}
|