<?php

namespace MovieEngine\Emails\Types;

if (! defined("ABSPATH")) {
    exit; // Exit if accessed directly
}

use MovieEngine\Emails\EmailBase;

class ForgotPasswordEmail extends EmailBase {
    public function trigger($user, $reset_url, $custom_to = '') {
        $subject = sprintf(
            /* translators: 1: site name */
            __('Password Reset Request - %1$s', 'cine-movie-engine'),
            get_bloginfo('name')
        );

        $data = [
            'user_name' => $user->display_name,
            'reset_url' => esc_url_raw($reset_url),
            'site_name' => get_bloginfo('name')
        ];

        $to = !empty($custom_to) ? $custom_to : $user->user_email;
        return $this->send($to, $subject, 'forgot_password', $data);
    }
}
