<?php

/**
 * Customer Trial Started email (plain text)
 *
 * @package ArraySubs\Features\Emails\templates\plain
 * @version 1.0.0
 */

defined('ABSPATH') || exit;

echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
echo esc_html(wp_strip_all_tags($arraysubs_email_heading));
echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";

printf(
    /* translators: %s: Customer first name */
    esc_html__('Hi %s,', 'arraysubs'),
    esc_html($arraysubs_customer['first_name'] ?: __('there', 'arraysubs'))
);
echo "\n\n";

printf(
    /* translators: %s: Product name */
    esc_html__('Your free trial for %s has started! Enjoy full access during your trial period.', 'arraysubs'),
    esc_html($arraysubs_product_name)
);
echo "\n\n";

echo "----------\n";
echo esc_html__('TRIAL DETAILS', 'arraysubs') . "\n";
echo "----------\n\n";

echo esc_html__('Subscription ID: ', 'arraysubs') . '#' . esc_html($arraysubs_subscription_number) . "\n";
echo esc_html__('Product: ', 'arraysubs') . esc_html($arraysubs_product_name) . "\n";

if (!empty($arraysubs_trial_length) && !empty($arraysubs_trial_period)) {
    echo esc_html__('Trial Length: ', 'arraysubs') . esc_html(\arraysubs_format_date_interval((int) $arraysubs_trial_length, $arraysubs_trial_period ?: 'day')) . "\n";
}

if (!empty($arraysubs_trial_end_date)) {
    echo esc_html__('Trial Ends On: ', 'arraysubs') . esc_html(\arraysubs_format_date_local($arraysubs_trial_end_date)) . "\n";
}

printf(
    /* translators: 1: price, 2: billing period */
    esc_html__('Post-Trial Price: %1$s / %2$s', 'arraysubs'),
    esc_html(wp_strip_all_tags($arraysubs_recurring_amount)),
    esc_html($arraysubs_billing_period)
);
echo "\n";

echo "\n";
echo esc_html__('When your trial ends, your subscription will automatically convert to a paid subscription and your payment method will be charged.', 'arraysubs');
echo "\n\n";

echo esc_html__('Manage your subscription here: ', 'arraysubs');
echo esc_url($arraysubs_my_account_url);
echo "\n\n";

/**
 * Show user-defined additional content - this is set in each email's settings.
 */
if ($arraysubs_additional_content) {
    echo "----------\n\n";
    echo esc_html(wp_strip_all_tags(wptexturize($arraysubs_additional_content)));
    echo "\n\n";
}

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WooCommerce core hook
echo wp_kses_post($arraysubs_email->format_string(apply_filters('woocommerce_email_footer_text', get_option('woocommerce_email_footer_text'))));
