namespace Email.Data.Services; /// /// Provides access to localised email templates stored in the emailApi.EmailTemplates table. /// Implementations are expected to cache templates and refresh periodically. /// public interface IEmailTemplateService { /// /// Returns the template value for the given key and language. /// Falls back to "en" when the requested language has no entry. /// Returns the raw key string when no matching template is found. /// /// Template key (e.g. "email.match.subject"). /// Two-letter language code (e.g. "en", "ro"). /// Template value string. string Get(string key, string language = "en"); /// /// Retrieves the template and substitutes {{placeholder}} tokens with the provided values. /// /// Template key. /// Two-letter language code. /// Named replacement pairs in the form ("name", value). /// Rendered template string with all placeholders replaced. string Render(string key, string language, params (string Key, string Value)[] placeholders); /// /// Returns the operator copy address for the given template key. /// Uses the specific row's OperatorCopy value when non-empty; otherwise falls back /// to the first non-empty OperatorCopy across all cached rows, so future template rows /// with an empty value automatically inherit the globally configured address. /// /// Template key used to look up the specific row (typically the subject key). /// Two-letter language code. /// Operator copy email address, or null when none is configured. string? GetOperatorCopy(string key, string language); }