<?php
/**
 * Image ALT Generator Module Entry Point.
 *
 * @package SmartyPress_AI_Engine
 */

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

if ( ! defined( 'SPAI_IAG_PLUGIN_ACTIVE' ) ) {
	define( 'SPAI_IAG_PLUGIN_VERSION', '1.0.0' );
	define( 'SPAI_IAG_PLUGIN_ACTIVE', true );
	define( 'SPAI_IAG_PLUGIN_DIR', dirname( __FILE__ ) );

	require_once SPAI_IAG_PLUGIN_DIR . '/class-image-alt-seo-context.php';
	require_once SPAI_IAG_PLUGIN_DIR . '/class-image-alt-context-analyzer.php';
	require_once SPAI_IAG_PLUGIN_DIR . '/class-image-alt-prompt-builder.php';
	require_once SPAI_IAG_PLUGIN_DIR . '/class-image-alt-service.php';
	require_once SPAI_IAG_PLUGIN_DIR . '/class-image-alt-index-manager.php';
	require_once SPAI_IAG_PLUGIN_DIR . '/class-image-alt-job-manager.php';
	require_once SPAI_IAG_PLUGIN_DIR . '/class-image-alt-generator-module.php';

	add_filter(
		'smartypress_ai_module_image_alt_generator_metadata',
		function() {
			return array(
				'name'        => __( 'Image ALT Generation', 'smartypress-ai-engine' ),
				'description' => __( 'Generate SEO-friendly ALT text and captions for Media Library images in bulk or on upload.', 'smartypress-ai-engine' ),
				'icon'        => SMARTYPRESS_AI_PLUGIN_URL . 'assets/images/image-generator-icon.svg',
				'type'        => 'internal',
				'build'       => 'free',
			);
		}
	);

	if ( class_exists( 'SmartyPress_AI_Image_ALT_Generator_Module' ) ) {
		$smartypress_ai_providers = SmartyPress_AI_Providers::get_all();
		$smartypress_ai_settings  = get_option( 'smartypress_ai_settings', array() );

		new SmartyPress_AI_Image_ALT_Generator_Module( $smartypress_ai_providers, $smartypress_ai_settings );
	}
}
