import Handlebars from 'handlebars'; export class TemplateRenderer { render( subjectTemplate: string, bodyTemplate: string, context: TemplateContext, ): { subject: string; body: string } { const subjectCompiled = Handlebars.compile(subjectTemplate); const bodyCompiled = Handlebars.compile(bodyTemplate); return { subject: subjectCompiled(context), body: bodyCompiled(context), }; } } export interface TemplateContext { ticket: { id: number; subject: string; status: string; queue_id: string; owner_id: string | null; creator_id: string; created_at: string; updated_at: string; }; queue: { name: string; }; transaction: { type: string; field: string | null; old_value: string | null; new_value: string | null; }; custom_fields: Record; }