// import { EmailTemplate } from "@/components/custom/ScheduleSender";
// import { Resend } from "resend";

// const resend = new Resend(process.env.RESEND_API_KEY);

// export async function POST(request) {
//   try {
//     const formData = await request.json();

//     const { data: resendData, error: resendError } = await resend.emails.send({
//       from: "support@rankrunners.net",
//       to: ["sales@rankrunners.net"],
//       subject: "New Quotes From /schedule",
//       react: EmailTemplate({
//         firstName: formData.firstName,
//         lastName: formData.lastName,
//         emailAddress: formData.emailAddress,
//         phoneNumber: formData.phoneNumber,
//         companyName: formData.companyName,
//         websiteUrl: formData.websiteUrl,
//         annualRevenue: formData.annualRevenue,
//         learnFrom: formData.learnFrom,
//         additionalInfo: formData.additionalInfo,
//       }),
//     });

//     if (resendError) {
//       return Response.json({ error: resendError }, { status: 500 });
//     }

//     const response = await fetch(
//       "https://cryagent.pythonanywhere.com/submitrankrunnersschedule",
//       {
//         method: "POST",
//         headers: {
//           "Content-Type": "application/json",
//         },
//         body: JSON.stringify({ email: formData.emailAddress }),
//       }
//     );

//     if (!response.ok) {
//       throw new Error("Failed to submit to cryagent.pythonanywhere.com");
//     }

//     const pythonAnywhereData = await response.json();

//     return Response.json({ resendData, pythonAnywhereData });
//   } catch (error) {
//     console.error("Error:", error);
//     return Response.json({ error: error.message }, { status: 500 });
//   }
// }