/*
* Copyright (c) 2023 Vaughn Nugent
*
* Library: VNLib
* Package: Emails.Transactional.Client
* File: TransactionalEmailConfig.cs
*
* TransactionalEmailConfig.cs is part of Emails.Transactional.Client which is part of the larger
* VNLib collection of libraries and utilities.
*
* Emails.Transactional.Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 2 of the License,
* or (at your option) any later version.
*
* Emails.Transactional.Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Emails.Transactional.Client. If not, see http://www.gnu.org/licenses/.
*/
using System;
using System.Collections.Generic;
namespace Emails.Transactional.Client
{
///
/// A global configuration object for transactional email clients
///
public class TransactionalEmailConfig
{
///
/// An email id template/translation table for email template-ids
///
public IReadOnlyDictionary TemplateIdLookup { get; private set; }
///
/// Sets the template lookup table for the current instance
///
/// The template-id lookup table to referrence
/// A referrence to the current object (fluent api)
///
public TransactionalEmailConfig WithTemplates(IReadOnlyDictionary templates)
{
TemplateIdLookup = templates ?? throw new ArgumentNullException(nameof(templates));
return this;
}
///
/// Gets a new from the specifed
/// template name.
///
///
///
///
///
public EmailTransactionRequest GetTemplateRequest(string templateName)
{
//get the template from its template name
string templateId = TemplateIdLookup[templateName];
return new EmailTransactionRequest(templateId);
}
}
}