<?php
/**
 * Load Email Delivery includes (idempotent).
 *
 * Admin-only helpers (AdminUi, DomainHealth, Diagnostics, SettingsImporter) load on demand.
 *
 * @package EmailSmtp
 * @since 1.1.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

require_once __DIR__ . DIRECTORY_SEPARATOR . 'bootstrap-transport.php';

$runtime = [
	'webhooks/WebhookSecurity.php',
	'webhooks/WebhookRouter.php',
];

$dir = __DIR__ . DIRECTORY_SEPARATOR;
foreach ( $runtime as $file ) {
	$path = $dir . $file;
	if ( is_readable( $path ) ) {
		require_once $path;
	}
}

$oauth = [
	'oauth/OAuthState.php',
	'oauth/OAuthTokenStore.php',
	'oauth/AbstractOAuthMailProvider.php',
	'oauth/OAuthCallbackHandler.php',
];
foreach ( $oauth as $file ) {
	$path = $dir . $file;
	if ( is_readable( $path ) ) {
		require_once $path;
	}
}
