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

defined( 'ABSPATH' ) || exit;

$mail_doctor_defaults = array(
	'subject' => 'Your {{shop_name}} order {{order_number}} is complete!',
	'heading' => 'Thanks, {{customer_name}}!',
	'html'    => '<div class="wpmd-email">' .
		'<div class="wpmd-email__logo">{{shop_brand}}</div>' .
		'<div class="wpmd-email__header">' .
		'<h1>{{heading}}</h1>' .
		'<p>{{order_date}} · {{order_number}}</p>' .
		'</div>' .
		'<p>{{customer_name}}, we are happy to let you know your order is ready. A summary is below.</p>' .
		'<div class="wpmd-email__order-table">' .
		'{{items_table}}' .
		'</div>' .
		'<p class="wpmd-email__total"><strong>Total paid:</strong> {{order_total}}</p>' .
		'{{download_links}}' .
		'<p>We appreciate your business. If you have any questions reply to this email or visit {{site_url}}.</p>' .
		'<p class="wpmd-email__signature">— {{shop_name}}</p>' .
		'</div>',
	'css'     => '.wpmd-email{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;color:#1f2933;background:#f7fafc;padding:32px;}' .
		'.wpmd-email__header{text-align:center;border-bottom:1px solid #d2d6dc;padding-bottom:16px;margin-bottom:24px;}' .
		'.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__header h1{margin:0;font-size:26px;color:#0c4a6e;}' .
		'.wpmd-email__header p{margin:8px 0 0;color:#52606d;font-size:14px;}' .
		'.wpmd-email__order-table{background:#ffffff;border-radius:6px;padding:16px;box-shadow:0 1px 2px rgba(15,23,42,0.08);}' .
		'.wpmd-email__total{font-size:16px;color:#0b7285;margin-top:20px;}' .
		'.wpmd-email__signature{margin-top:28px;color:#364152;font-size:13px;}' .
		'.wpmd-items-table{width:100%;border-collapse:collapse;margin:0;}' .
		'.wpmd-items-table thead{background:#e0f2fe;}' .
		'.wpmd-items-table th{padding:12px;text-align:left;font-size:14px;color:#0f172a;border-bottom:1px solid #bae6fd;}' .
		'.wpmd-items-table td{padding:12px;border-bottom:1px solid #e2e8f0;color:#1f2937;font-size:14px;}' .
		'.wpmd-items-table tfoot th,.wpmd-items-table tfoot td{border-bottom:none;font-weight:600;background:#f1f5f9;}' .
		'.wpmd-download-links{margin:18px 0 0;padding:0;list-style:none;}' .
		'.wpmd-download-links li{margin:6px 0;}' .
		'.wpmd-download-links a{color:#1d4ed8;text-decoration:none;}' .
		'.wpmd-download-links a:hover{text-decoration:underline;}',
);

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