<?php
/**
 * Plugin Name:     SI Fast Product Importer for WooCommerce
 * Description:     Import high-quality, pre-configured products into your WooCommerce store with just a few clicks. Includes AI-powered product generation, a vast product database, and one-click imports.
 * Version:         1.2.0
 * Author:          Studio Immens
 * Text Domain:     si-fast-product-importer
 * License:         GPLv2 or later
 * License URI:     https://www.gnu.org/licenses/gpl-2.0.html
 * Domain Path:     /languages
 * Requires PHP:    7.4
 * Requires at least: 5.8
 * Tested up to:   7.0
 * Requires Plugins: woocommerce
 * WC requires at least: 5.0
 */

defined( 'ABSPATH' ) || exit;

/**
 * Register with WP Consent API to declare support and follow guidelines.
 */
add_filter( 'wp_consent_api_registered_' . plugin_basename( __FILE__ ), '__return_true' );

// Define SIFProd_FILE
if ( ! defined( 'SIFProd_FILE' ) ) {
	define( 'SIFProd_FILE', __FILE__ );
}

/**
 * Autoloader for SIFlashProducts namespace
 */
spl_autoload_register( function ( $class ) {
	$prefix = 'SIFlashProducts\\';
	$base_dir = __DIR__ . '/includes/';

	$len = strlen( $prefix );
	if ( strncmp( $prefix, $class, $len ) !== 0 ) {
		return;
	}

	$relative_class = substr( $class, $len );
	$file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php';

	if ( file_exists( $file ) ) {
		require_once $file;
	}
} );

/**
 * Initialize the plugin
 */
function sifp_init_plugin() {
	// Let the Core\Plugin class handle includes and initialization
	return \SIFlashProducts\Core\Plugin::instance();
}

sifp_init_plugin();
