'use strict'

function otpEmailHtml (code) {
  return `<div style="font-family:system-ui;max-width:400px;margin:0 auto;padding:24px">
    <h2 style="color:#3949ab;margin:0 0 16px">Vérification</h2>
    <p style="color:#334155;font-size:14px">Votre code de vérification est :</p>
    <div style="font-size:32px;font-weight:700;letter-spacing:8px;text-align:center;padding:16px;background:#f1f5f9;border-radius:8px;color:#1e293b">${code}</div>
    <p style="color:#94a3b8;font-size:12px;margin-top:16px">Ce code expire dans 10 minutes.</p>
  </div>`
}

function orderConfirmationHtml ({ orderName, customer_name, itemRows, preferred_date, preferred_slot }) {
  return `<!DOCTYPE html><html><head><meta charset="utf-8"></head><body style="font-family:system-ui;margin:0;padding:0;background:#f1f5f9">
<div style="max-width:560px;margin:0 auto;padding:24px">
  <div style="background:white;border-radius:16px;overflow:hidden;box-shadow:0 4px 24px rgba(0,0,0,0.06)">
    <div style="background:linear-gradient(135deg,#22c55e,#16a34a);color:white;padding:24px 28px">
      <h1 style="margin:0;font-size:20px">Commande confirm&eacute;e</h1>
      <p style="margin:6px 0 0;opacity:0.85;font-size:13px">${orderName || 'Merci pour votre commande'}</p>
    </div>
    <div style="padding:24px 28px">
      <p style="color:#334155;font-size:14px;margin:0 0 16px">Bonjour ${customer_name},</p>
      <table style="width:100%;border-collapse:collapse;font-size:14px"><tbody>${itemRows}</tbody></table>
      ${preferred_date ? `<p style="margin:16px 0 0;color:#475569;font-size:13px"><strong>Date souhait&eacute;e :</strong> ${preferred_date} ${preferred_slot || ''}</p>` : ''}
      <p style="margin:16px 0 0;color:#475569;font-size:13px">Nous vous contacterons pour confirmer les d&eacute;tails.</p>
    </div>
    <div style="border-top:1px solid #e2e8f0;padding:16px 28px;text-align:center">
      <p style="color:#94a3b8;font-size:11px;margin:0">Gigafibre — Targo T&eacute;l&eacute;communications</p>
    </div>
  </div>
</div></body></html>`
}

module.exports = { otpEmailHtml, orderConfirmationHtml }
