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

defined( 'ABSPATH' ) || exit;

$mail_doctor_defaults = array(
	'subject' => 'A note was added to your order {{order_number}}',
	'heading' => 'Order update',
	'html'    => '<div class="wpmd-email">' .
		'<div class="wpmd-email__logo">{{shop_brand}}</div>' .
		'<h1>{{heading}}</h1>' .
		'<p>Hi {{customer_name}}, we added an update to your order {{order_number}}.</p>' .
		'<p>Visit your account at {{site_url}} to review the latest details.</p>' .
		'<div class="wpmd-email__note">{{customer_note}}</div>' .
		'<p><strong>Order total:</strong> {{order_total}}</p>' .
		'</div>',
	'css'     => '.wpmd-email{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;padding:24px;background:#ffffff;color:#111827;}' .
		'.wpmd-email h1{margin-top:0;font-size:22px;color:#7c3aed;}' .
		'.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;}' .
		'.wpmd-email__note{margin-top:16px;padding:16px;background:#f5f3ff;border-left:4px solid #7c3aed;}',
);

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_note',
		$mail_doctor_order_id,
		array(
			'defaults' => $mail_doctor_defaults,
		)
	)
);
