const FRONTEND_URL = process.env.FRONTEND_URL;

function passwordReset(token, email) {
    const link = `${FRONTEND_URL}?token=${encodeURIComponent(token)}&email=${encodeURIComponent(email)}`;
    return `
        <html>
            <body style="font-family: Arial, sans-serif; background-color: #f7f7f7; margin: 0; padding: 0;">
                <table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f7f7f7; padding: 40px 0;">
                    <tr>
                        <td align="center">
                            <table width="480" cellpadding="0" cellspacing="0" style="background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); padding: 32px;">
                                <tr>
                                    <td align="center" style="padding-bottom: 24px;">
                                        <h2 style="color: #333; margin: 0;">Password Reset Request</h2>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="color: #444; font-size: 16px; padding-bottom: 16px;">
                                        Hello, <strong>${email}</strong>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="color: #444; font-size: 16px; padding-bottom: 24px;">
                                        Please click the button below to reset your password:
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" style="padding-bottom: 24px;">
                                        <a href="${link}" style="background: #007bff; color: #fff; text-decoration: none; padding: 12px 32px; border-radius: 4px; font-size: 16px; display: inline-block;">
                                            Reset Password
                                        </a>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="color: #888; font-size: 14px; padding-bottom: 8px;">
                                        Or copy and paste this link into your browser:
                                    </td>
                                </tr>
                                <tr>
                                    <td style="word-break: break-all; color: #007bff; font-size: 14px; padding-bottom: 24px;">
                                        ${link}
                                    </td>
                                </tr>
                                <tr>
                                    <td style="color: #888; font-size: 13px;">
                                        If you did not request this, please ignore this email.
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </body>
        </html>
    `;
}

module.exports = {passwordReset};