<?php
/**
 * Plugin Name:       Kitsune AI Platform
 * Author URI:        https://profiles.wordpress.org/prasadkirpekar
 * Description:       Advanced AI-powered WordPress plugin with chatbots, content generation, forms, knowledge base, and automation
 * Version:           1.0.0
 * Author:            Prasad Kirpekar
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       kitsune-ai-platform
 * Domain Path:       /languages
 * Requires at least: 5.8
 * Requires PHP:      7.4
 */

// If this file is called directly, abort.
if (!defined('WPINC')) {
    die;
}

/**
 * Plugin Constants
 */
define('KITSUNE_AI_PLATFORM_VERSION', '1.0.1');
define('KITSUNE_AI_PLATFORM_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('KITSUNE_AI_PLATFORM_PLUGIN_URL', plugin_dir_url(__FILE__));
define('KITSUNE_AI_PLATFORM_PLUGIN_BASENAME', plugin_basename(__FILE__));

/**
 * Activation hook
 * Creates database tables and sets default options
 */
register_activation_hook(__FILE__, 'kitsune_ai_platform_activate_plugin');
function kitsune_ai_platform_activate_plugin() {
    require_once KITSUNE_AI_PLATFORM_PLUGIN_DIR . 'includes/class-kitsune-ai-platform-activator.php';
    Kitsune_AI_Platform_Activator::activate();
}

/**
 * Deactivation hook
 * Cleans up scheduled events
 */
register_deactivation_hook(__FILE__, 'kitsune_ai_platform_deactivate_plugin');
function kitsune_ai_platform_deactivate_plugin() {
    require_once KITSUNE_AI_PLATFORM_PLUGIN_DIR . 'includes/class-kitsune-ai-platform-deactivator.php';
    Kitsune_AI_Platform_Deactivator::deactivate();
}

/**
 * Load model constants (single source of truth for all AI model IDs).
 * Must be loaded before the autoloader so constants are available everywhere.
 */
require_once KITSUNE_AI_PLATFORM_PLUGIN_DIR . 'includes/constants/class-kitsune-ai-platform-model-constants.php';

/**
 * Load plugin autoloader
 */
require_once KITSUNE_AI_PLATFORM_PLUGIN_DIR . 'includes/class-kitsune-ai-platform-autoloader.php';
Kitsune_AI_Platform_Autoloader::register();

/**
 * Load plugin core class
 */
require_once KITSUNE_AI_PLATFORM_PLUGIN_DIR . 'includes/class-kitsune-ai-platform-core.php';

/**
 * Initialize and run the plugin
 */
function kitsune_ai_platform_run_plugin() {
    $plugin = new Kitsune_AI_Platform_Core();
    $plugin->run();
}

kitsune_ai_platform_run_plugin();
