<?php

declare(strict_types=1);

require_once __DIR__ . '/layout.php';

function iav_password_reset_email(string $displayName, string $resetUrl, int $expiresMinutes = 30): string
{
    $safeName = htmlspecialchars($displayName, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
    $minutes = max(1, $expiresMinutes);
    $body = "<p>Hello {$safeName},</p><p>We received a request to reset your password. The secure link expires in {$minutes} minutes and can only be used once.</p><p>If you did not request a reset, leave your password unchanged and contact support if needed.</p>";

    return iav_mail_layout('Reset your password', $body, 'Reset password', $resetUrl);
}
