import { baseEmailLayout } from "./baseLayout.js";

/**
 * Generate the password reset email template.
 *
 * @param {object} params
 * @param {string} params.name - Recipient's name or business name
 * @param {string} params.resetUrl - Full reset URL with token
 * @returns {string} Full HTML string
 */
export const passwordResetTemplate = ({ name, resetUrl }) => {
  const content = `
    <p style="font-size: 13px; color: #888; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; margin-bottom: 4px;">
      🔑 Password Reset
    </p>

    <p style="font-size: 22px; font-weight: 800; color: #1a1a2e; margin-bottom: 8px;">
      Hi, ${name}
    </p>

    <p>
      We received a request to reset the password for your Airpero merchant account. 
      Click the button below to create a new password. This link is valid for <strong>30 minutes</strong>.
    </p>

    <div style="text-align: center; margin: 36px 0;">
      <a href="${resetUrl}"
        style="
          display: inline-block;
          background: linear-gradient(135deg, #7c3aed, #5b21b6);
          color: #ffffff;
          text-decoration: none;
          font-size: 16px;
          font-weight: 700;
          padding: 16px 40px;
          border-radius: 8px;
          letter-spacing: 0.3px;
          box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
        ">
        Reset My Password
      </a>
    </div>

    <p style="font-size: 13px; color: #888; text-align: center;">
      Or paste this link directly into your browser:<br />
      <a href="${resetUrl}" style="color: #7c3aed; word-break: break-all; font-size: 12px;">${resetUrl}</a>
    </p>

    <div style="background: #fff8ec; border-left: 4px solid #f59e0b; border-radius: 4px; padding: 14px 18px; margin-top: 24px;">
      <p style="font-size: 13px; color: #78350f; margin: 0;">
        <strong>Did not request this?</strong> You can safely ignore this email. Your password will not change.
        If you believe this is suspicious, please <a href="mailto:support@airpero.com" style="color: #7c3aed; font-weight: 600;">contact support</a>.
      </p>
    </div>
  `;

  return baseEmailLayout({ htmlContent: content, title: "Airpero — Reset Your Password" });
};
