import { z } from "zod";
const sendEmailPayloadSchema = z.object({
  /**  */
  to: z.string(),
  /** The email template to send */
  template: z.string(),
  payload: z.string()
});
async function sendEmail(payload) {
  try {
    const parsedPayload = sendEmailPayloadSchema.parse(JSON.parse(payload));
    console.log(parsedPayload);
    const emails = await import("./index-tQ_rjTuZ.js");
    const email = emails[parsedPayload.template];
    if (!email)
      throw new Error("Invalid email template");
    await email(parsedPayload.to);
  } catch (error) {
    console.error(error);
    throw error;
  }
}
export {
  sendEmail
};
