import {SendMail} from "@/server/utils/mailer";

export const sendNewRegisterEmail = async ({firstname, lastname,phone, email,company,jobTitle,fieldOfActivity,message}) => {

    try {

        const emailContent = `
  <div style="font-family: Arial, sans-serif; line-height: 1.6; color: #333;">
    <h2>Booking Demo</h2>
    <table style="width: 100%; border-collapse: collapse;">
      <tr>
        <td style="font-weight: bold; width: 130px; padding: 8px; border: 1px solid #ccc;">First Name</td>
        <td style="padding: 8px; border: 1px solid #ccc;">${firstname || ""}</td>
      </tr>
      <tr>
        <td style="font-weight: bold; width: 130px; padding: 8px; border: 1px solid #ccc;">Last Name</td>
        <td style="padding: 8px; border: 1px solid #ccc;">${lastname || ""}</td>
      </tr>
      <tr>
        <td style="font-weight: bold; width: 130px; padding: 8px; border: 1px solid #ccc;">Email</td>
        <td style="padding: 8px; border: 1px solid #ccc;">${email || ""}</td>
      </tr>
      <tr>
        <td style="font-weight: bold; width: 130px; padding: 8px; border: 1px solid #ccc;">Phone Number</td>
        <td style="padding: 8px; border: 1px solid #ccc;">${phone || ""}</td>
      </tr>
      <tr>
        <td style="font-weight: bold; width: 130px; padding: 8px; border: 1px solid #ccc;">Company</td>
        <td style="padding: 8px; border: 1px solid #ccc;">${company || ""}</td>
      </tr>
      <tr>
        <td style="font-weight: bold; width: 130px; padding: 8px; border: 1px solid #ccc;">Job Title</td>
        <td style="padding: 8px; border: 1px solid #ccc;">${jobTitle || ""}</td>
      </tr>
      <tr>
        <td style="font-weight: bold; width: 130px; padding: 8px; border: 1px solid #ccc;">Field of Activity</td>
        <td style="padding: 8px; border: 1px solid #ccc;">${fieldOfActivity || ""}</td>
      </tr>
 
      <tr>
        <td style="font-weight: bold; width: 130px; padding: 8px; border: 1px solid #ccc;">Messgae</td>
        <td style="padding: 8px; border: 1px solid #ccc;">${message || ""}</td>
      </tr>
    </table>
  </div>
`;


        let sendEmail = await SendMail({
            from: "no-replay@viraws.ir",
            // to: "miladvgeneral@gmail.com,fakhroleslam@viraws.ir,info@viraws.ir",
            to: "miladvgeneral@gmail.com",
            subject: "Demo Booking | ChemPlan",
            text: emailContent
        })
        return null

    } catch (e) {
        console.log("An Error occurred in Send Mail After Register:", e.message)
        return null
    }
}