<?php

/**
 * Customer Subscription Reactivated email
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/emails/customer-subscription-reactivated.php.
 *
 * @package ArraySubs\Features\Emails\templates
 * @version 1.0.0
 *
 * @var string $email_heading Email heading.
 * @var \WP_Post $subscription Subscription post object.
 * @var int $subscription_id Subscription ID.
 * @var \WC_Product $product Product object.
 * @var \WP_User $customer Customer object.
 * @var string $next_payment_date Next payment date.
 * @var string $additional_content Additional content.
 * @var bool $sent_to_admin Is sent to admin.
 * @var bool $plain_text Is plain text.
 * @var \WC_Email $email Email object.
 */

defined('ABSPATH') || exit;

/*
 * @hooked WC_Emails::email_header() Output the email header
 */
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WooCommerce core hook
do_action('woocommerce_email_header', $arraysubs_email_heading, $arraysubs_email);
?>

<p>
<?php
    printf(
        /* translators: %s: Customer first name */
        esc_html__('Hi %s,', 'arraysubs'),
        esc_html($arraysubs_customer['first_name'])
    );
    ?>
    </p>

<p>
<?php
    printf(
        /* translators: %s: Product name */
        esc_html__('Great news! Your subscription for %s has been reactivated and is now active again.', 'arraysubs'),
        '<strong>' . esc_html($arraysubs_product ? $arraysubs_product->get_name() : __('N/A', 'arraysubs')) . '</strong>'
    );
    ?>
    </p>

<h2><?php esc_html_e('Subscription Details', 'arraysubs'); ?></h2>

<table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" border="1">
    <tbody>
        <tr>
            <th class="td" scope="row" style="text-align:left;">
                <?php esc_html_e('Subscription ID', 'arraysubs'); ?>
            </th>
            <td class="td" style="text-align:left;">
                #<?php echo esc_html($arraysubs_subscription_id); ?>
            </td>
        </tr>
        <tr>
            <th class="td" scope="row" style="text-align:left;">
                <?php esc_html_e('Product', 'arraysubs'); ?>
            </th>
            <td class="td" style="text-align:left;">
                <?php echo esc_html($arraysubs_product ? $arraysubs_product->get_name() : __('N/A', 'arraysubs')); ?>
            </td>
        </tr>
        <tr>
            <th class="td" scope="row" style="text-align:left;">
                <?php esc_html_e('Status', 'arraysubs'); ?>
            </th>
            <td class="td" style="text-align:left; color: #46b450;">
                <?php esc_html_e('Active', 'arraysubs'); ?>
            </td>
        </tr>
        <?php if (!empty($arraysubs_next_payment_date)) : ?>
            <tr>
                <th class="td" scope="row" style="text-align:left;">
                    <?php esc_html_e('Next Payment Date', 'arraysubs'); ?>
                </th>
                <td class="td" style="text-align:left;">
                    <?php echo esc_html(\arraysubs_format_date_local($arraysubs_next_payment_date)); ?>
                </td>
            </tr>
        <?php endif; ?>
    </tbody>
</table>

<p style="margin-top: 20px;">
    <?php esc_html_e('Your subscription is now active and you will be charged on your next payment date. Thank you for continuing with us!', 'arraysubs'); ?>
</p>

<p>
    <a href="<?php echo esc_url(wc_get_endpoint_url('subscriptions', '', wc_get_page_permalink('myaccount'))); ?>" class="button" style="display: inline-block; padding: 12px 24px; background-color: #96588a; color: #ffffff; text-decoration: none; border-radius: 4px;">
        <?php esc_html_e('View Your Subscription', 'arraysubs'); ?>
    </a>
</p>

<?php
/**
 * Show user-defined additional content - this is set in each email's settings.
 */
if ($arraysubs_additional_content) {
    echo wp_kses_post(wpautop(wptexturize($arraysubs_additional_content)));
}

/*
 * @hooked WC_Emails::email_footer() Output the email footer
 */
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WooCommerce core hook
do_action('woocommerce_email_footer', $arraysubs_email);
