import * as z from 'zod'; import { defineEmail } from '../send'; import { getDefaultTemplate } from '../templates'; import { ZEmailBranding } from '../core/branding'; export const studentCourseCompletionEmail = defineEmail({ id: 'studentCourseCompletion', subject: 'Congratulations — you completed the course requirements', schema: z.object({ orgName: z.string().min(1), courseName: z.string().min(1), studentName: z.string().min(1), certificateUrl: z.string().url(), customMessage: z.string().nullable().optional(), branding: ZEmailBranding }), render: (fields) => { const customBlock = fields.customMessage && fields.customMessage.trim().length > 0 ? `
Hi ${fields.studentName},
Congratulations! You have met the completion requirements for ${fields.courseName}.
${customBlock}If the button does not work, copy and paste this link into your browser:
${fields.certificateUrl}
Cheers,
${fields.orgName}