<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class ASA_Loader {

	public function run() {
		if ( file_exists( ASA_DIR . 'vendor/autoload.php' ) ) {
			require_once ASA_DIR . 'vendor/autoload.php';
		}
		require_once ASA_DIR . 'includes/class-asa-logger.php';
		require_once ASA_DIR . 'includes/class-asa-auth.php';
		require_once ASA_DIR . 'includes/class-asa-rest.php';
		require_once ASA_DIR . 'includes/class-asa-hardening-scan.php';
		require_once ASA_DIR . 'includes/class-asa-malware-scan.php';
		require_once ASA_DIR . 'includes/class-asa-diff-scan.php';
		require_once ASA_DIR . 'includes/class-asa-local-inventory.php';
		require_once ASA_DIR . 'includes/class-asa-inventory-scan.php';
		require_once ASA_DIR . 'includes/class-asa-wpvulnerability-provider.php';
		require_once ASA_DIR . 'includes/class-asa-vulnerability-scan.php';
		require_once ASA_DIR . 'includes/class-asa-static-scan.php';
		require_once ASA_DIR . 'includes/class-asa-compliance-scan.php';
		require_once ASA_DIR . 'includes/class-asa-permission-scan.php';
		require_once ASA_DIR . 'includes/class-asa-aegisify-correlation.php';
		require_once ASA_DIR . 'includes/class-asa-snapshot-manager.php';
		require_once ASA_DIR . 'includes/class-asa-telemetry.php';
		require_once ASA_DIR . 'includes/class-asa-wp-activity-log.php';
		require_once ASA_DIR . 'includes/class-asa-report-builder.php';
		require_once ASA_DIR . 'includes/class-asa-admin.php';

		register_activation_hook( ASA_FILE, array( 'ASA_Admin', 'activate' ) );
		add_action( 'plugins_loaded', array( $this, 'init' ) );
	}

	public function init() {
		( new ASA_Logger() )->init();
		( new ASA_Auth() )->init();
		( new ASA_REST() )->init();
		( new ASA_Admin() )->init();
		( new ASA_WP_Activity_Log() )->init();
	}
}
