<?php
/**
 * Autoload centralisé — classes admin AVI.
 * Ajouter ici toute nouvelle classe admin.
 * NE JAMAIS require_once directement dans avision-dashboard.php.
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$avi_admin_classes = array(
	'includes/admin/class-avision-dashboard-health.php',
	'includes/admin/class-avision-health-check.php',
	'includes/admin/class-avision-plugin-security-scan.php',
	'includes/admin/class-avision-api-cron-monitor.php',
	'includes/admin/class-avision-cron-dashboard.php',
	'includes/admin/class-avision-control-center.php',
	'includes/admin/class-avision-code-guard-center.php',
	'includes/admin/class-avision-appsumo-admin.php',
	'includes/admin/class-avision-nonprofit-admin.php',
	'includes/admin/class-avision-founding-sponsors-admin.php',
);

foreach ( $avi_admin_classes as $avi_admin_file ) {
	$avi_admin_path = AVISION_PATH . $avi_admin_file;
	if ( file_exists( $avi_admin_path ) ) {
		require_once $avi_admin_path;
	} else {
		error_log( '[AVI-AUTOLOAD] Fichier admin manquant : ' . $avi_admin_path );
	}
}

// Init des classes après chargement
if ( class_exists( 'Avision_Health_Check' ) ) {
	Avision_Health_Check::init_crons();
}
if ( class_exists( 'Avision_Plugin_Security_Scan' ) ) {
	Avision_Plugin_Security_Scan::init_crons();
}
if ( class_exists( 'Avision_Api_Cron_Monitor' ) ) {
	Avision_Api_Cron_Monitor::init_crons();
}
if ( class_exists( 'Avision_Cron_Dashboard' ) ) {
	Avision_Cron_Dashboard::init();
}
if ( class_exists( 'Avision_Control_Center' ) ) {
	Avision_Control_Center::init();
}
if ( class_exists( 'Avision_Dashboard_Health' ) ) {
	Avision_Dashboard_Health::init();
}
if ( class_exists( 'Avision_Code_Guard_Center' ) ) {
	Avision_Code_Guard_Center::init();
}
if ( class_exists( 'Avision_AppSumo_Admin' ) ) {
	Avision_AppSumo_Admin::init();
}
if ( class_exists( 'Avision_Nonprofit_Admin' ) ) {
	Avision_Nonprofit_Admin::init();
}
