<?php
/**
 * Email Statistics Template
 *
 * Displays performance statistics in a formatted list within emails.
 *
 * @since 2.15.0
 * @package wc-affiliate
 * @var array $stats Associative array of statistic labels and values
 */

/**
 * Filter the stats section title
 *
 * @param string $title The section title
 * @param array $stats The statistics data
 */
$title = apply_filters( 'wc_affiliate_email_stats_title', 'Your Performance Summary', $stats );

/**
 * Filter the stats wrapper HTML
 *
 * @param string $wrapper_html The wrapper HTML with %s placeholder for content
 * @param array $stats The statistics data
 * @param string $title The section title
 */
$wrapper_html = apply_filters( 'wc_affiliate_email_stats_wrapper', '<div class="stats"><h3 style="margin-top: 0; color: #1f2937;">%s</h3>%s</div>', $stats, $title );

$content = '';
foreach ( $stats as $label => $value ) {
	$content .= sprintf( '<div class="stat-item"><strong>%s:</strong> %s</div>', esc_html( $label ), $value );
}

printf( $wrapper_html, esc_html( $title ), $content );
