<?php
/**
 * SEO Analysis Module Entry Point
 *
 * @package SmartyPress_AI_Engine
 * @since 1.0.0
 */

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

if ( ! defined( 'SPAI_SA_PLUGIN_ACTIVE' ) ) {
	define( 'SPAI_SA_PLUGIN_VERSION', '1.0.0' );
	define( 'SPAI_SA_PLUGIN_ACTIVE', true );
	define( 'SPAI_SA_PLUGIN_DIR', dirname( __FILE__ ) );
	define( 'SPAI_SA_PLUGIN_URL', plugins_url( '', __FILE__ ) );

	require_once SPAI_SA_PLUGIN_DIR . '/class-seo-analysis-openrouter-capabilities.php';
	require_once SPAI_SA_PLUGIN_DIR . '/class-seo-analysis-plan-hooks.php';
	require_once SPAI_SA_PLUGIN_DIR . '/class-seo-analysis-prompts.php';
	require_once SPAI_SA_PLUGIN_DIR . '/class-seo-analysis-response-parser.php';
	require_once SPAI_SA_PLUGIN_DIR . '/class-seo-analysis-competitor-research-service.php';
	require_once SPAI_SA_PLUGIN_DIR . '/class-seo-analysis-competitor-controller.php';
	require_once SPAI_SA_PLUGIN_DIR . '/class-seo-analysis-module.php';

	add_filter(
		'smartypress_ai_module_seo_analysis_metadata',
		function( $metadata ) {
			return array(
				'name'        => __( 'SEO Analysis', 'smartypress-ai-engine' ),
				'description' => __( 'Adds competitor SEO analysis and research hooks for AI content plans.', 'smartypress-ai-engine' ),
				'icon'        => SMARTYPRESS_AI_PLUGIN_URL . 'assets/images/seo-analysis-icon.svg',
				'type'        => 'internal',
				'build'       => 'free',
			);
		}
	);

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

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