<?php
/**
 * Load AI Alt Text classes required for settings persistence.
 *
 * @package AIAltTextGenerator
 * @since 2.0.1
 */

namespace AIAltTextGenerator;

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

if ( ! function_exists( __NAMESPACE__ . '\\ensure_dependencies' ) ) {
	/**
	 * Ensure settings-related classes are available when loaded in isolation.
	 */
	function ensure_dependencies(): void {
		static $loaded = false;

		if ( $loaded ) {
			return;
		}

		$dir   = __DIR__;
		$files = [
			'class-capabilities.php',
			'class-feature-gate.php',
			'class-languages.php',
			'class-network-settings.php',
			'class-prompt-styles.php',
			'class-models.php',
			'class-provider-models.php',
		];

		foreach ( $files as $file ) {
			$path = $dir . '/' . $file;
			if ( is_readable( $path ) ) {
				require_once $path;
			}
		}

		$loaded = true;
	}
}

ensure_dependencies();
