<?php

/**
 * Generic notification email template.
 * Fallback for events without a specific template.
 *
 * Variables via $data array:
 * - $data['site_name'], $data['site_url'], $data['label']
 * - $data['message'] (string, optional - custom message body)
 * - $data['details'] (array, optional - key-value pairs to display)
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}
?>
<h1><?php echo esc_html( $data['label'] ?? 'Security Notification' ); ?></h1>

<?php if ( ! empty( $data['message'] ) ) : ?>
<p><?php echo esc_html( $data['message'] ); ?></p>
<?php endif; ?>

<div class="detail-box">
    <strong>Site:</strong> <?php echo esc_html( $data['site_url'] ?? '' ); ?><br>
    <?php if ( ! empty( $data['details'] ) && is_array( $data['details'] ) ) : ?>
        <?php foreach ( $data['details'] as $securwp_key => $securwp_value ) : ?>
        <strong><?php echo esc_html( ucfirst( str_replace( '_', ' ', $securwp_key ) ) ); ?>:</strong>
        <?php echo esc_html( is_scalar( $securwp_value ) ? (string) $securwp_value : wp_json_encode( $securwp_value ) ); ?><br>
        <?php endforeach; ?>
    <?php endif; ?>
</div>
