<?php
/**
 * Default customer refunded order email template.
 *
 * @package MailDoctor
 */

defined( 'ABSPATH' ) || exit;

$mail_doctor_defaults = array(
	'subject' => 'Refund issued for order {{order_number}}',
	'heading' => 'Refund processed',
	'html'    => '<div class="wpmd-email">' .
		'<div class="wpmd-email__logo">{{shop_brand}}</div>' .
		'<h1>{{heading}}</h1>' .
		'<p>Hi {{customer_name}}, a refund has been processed for your order {{order_number}}.</p>' .
		'<p><strong>Refund amount:</strong> {{refund_amount}}</p>' .
		'<p><strong>Original total:</strong> {{order_total}}</p>' .
		'<p>The funds should return to your account in 3–5 business days.</p>' .
		'</div>',
	'css'     => '.wpmd-email{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;padding:24px;background:#f8fafc;color:#0f172a;}' .
		'.wpmd-email h1{margin-top:0;font-size:24px;color:#0ea5e9;}' .
		'.wpmd-email__logo{margin:0 0 16px;text-align:center;}' .
		'.wpmd-email__logo img{max-width:200px;height:auto;}' .
		'.wpmd-brand-text{font-weight:700;font-size:20px;color:inherit;}',
);

global $mail_doctor_collecting_defaults;

if ( ! empty( $mail_doctor_collecting_defaults ) ) {
	return $mail_doctor_defaults;
}

$mail_doctor_order_id = 0;
if ( isset( $order ) && class_exists( 'WC_Order' ) && $order instanceof WC_Order ) {
	$mail_doctor_order_id = $order->get_id();
}

echo wp_kses_post(
	mail_doctor_render_email(
		'customer_refunded_order',
		$mail_doctor_order_id,
		array(
			'defaults' => $mail_doctor_defaults,
		)
	)
);
