<?php
/**
 * Plugin Name:       MasterQuiz AI
 * Plugin URI:        https://elearningevolve.com/
 * Description:       Generate AI-powered quizzes from PDF documents. Supports LearnDash LMS integration with automatic quiz creation, plus 9 export formats for any LMS.
 * Version:           1.0.4
 * Requires at least: 5.8
 * Requires PHP:      7.4
 * Author:            eLearning Evolve
 * Author URI:        https://elearningevolve.com/
 * License:           GPL-2.0-or-later
 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain:       masterquiz-ai
 * Domain Path:       /languages
 *
 * @package MasterQuiz
 */

// Prevent direct file access.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Plugin version constant.
 */
define( 'MASTERQUIZ_VERSION', '1.0.4' );

/**
 * Plugin directory path (with trailing slash).
 */
define( 'MASTERQUIZ_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );

/**
 * Plugin directory URL (with trailing slash).
 */
define( 'MASTERQUIZ_PLUGIN_URL', plugin_dir_url( __FILE__ ) );

/**
 * Plugin basename.
 */
define( 'MASTERQUIZ_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );

/**
 * Plugin text domain.
 */
define( 'MASTERQUIZ_TEXT_DOMAIN', 'masterquiz-ai' );

/**
 * Plugin main file path.
 */
define( 'MASTERQUIZ_PLUGIN_FILE', __FILE__ );

// Include Composer autoloader if it exists.
if ( file_exists( MASTERQUIZ_PLUGIN_DIR . 'vendor/autoload.php' ) ) {
	require_once MASTERQUIZ_PLUGIN_DIR . 'vendor/autoload.php';
}

// Include core class files.
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-loader.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-activator.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-deactivator.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-i18n.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-logger.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-settings.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-shortcode.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-ajax-handler.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-upload-handler.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-background-process.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-pdf-extractor.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-ai-provider.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-gemini-provider.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-openrouter-provider.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-groq-provider.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-provider-chain.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-quiz-generator.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-rag-client.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-exporter.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'includes/class-masterquiz-learndash.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'admin/class-masterquiz-admin.php';
require_once MASTERQUIZ_PLUGIN_DIR . 'public/class-masterquiz-public.php';

/**
 * Run activation hook.
 */
register_activation_hook( __FILE__, array( 'MasterQuiz_Activator', 'activate' ) );

/**
 * Run deactivation hook.
 */
register_deactivation_hook( __FILE__, array( 'MasterQuiz_Deactivator', 'deactivate' ) );

/**
 * Begin plugin execution.
 *
 * @since 1.0.0
 */
function masterquiz_run() {
	$plugin = new MasterQuiz_Loader();
	$plugin->run();
}

masterquiz_run();
