<?php
if (!defined('ABSPATH'))
    exit;

class Dori_Chatbot_Plugin_Loader
{
    public static function init()
    {
        self::load_dependencies();
        self::init_components();
    }

    private static function load_dependencies()
    {
        $base_path = plugin_dir_path(dirname(dirname(__FILE__)));

        require_once $base_path . 'includes/core/class-logger.php';
        require_once $base_path . 'includes/core/class-cache-manager.php';
        require_once $base_path . 'includes/services/class-api-constants.php';
        require_once $base_path . 'includes/services/class-api-client.php';
        require_once $base_path . 'includes/services/class-kavenegar-client.php';
        require_once $base_path . 'includes/services/class-mori-style-client.php';
        require_once $base_path . 'includes/services/class-standard-api-client.php';
        require_once $base_path . 'includes/services/class-gollum-client.php';
        require_once $base_path . 'includes/services/class-diagnostic-utils.php';
        require_once $base_path . 'includes/services/class-crawler-service.php';
        require_once $base_path . 'includes/services/class-bot-creator.php';
        require_once $base_path . 'includes/services/class-settings-service.php';
        require_once $base_path . 'includes/api/class-public-api.php';
        require_once $base_path . 'includes/api/class-gateland-api.php';
        require_once $base_path . 'includes/api/class-admin-ui-api.php';

        require_once $base_path . 'includes/woocommerce/class-woocommerce-session.php';
        require_once $base_path . 'includes/woocommerce/class-woocommerce-api-keys.php';
        require_once $base_path . 'includes/woocommerce/class-woocommerce-order-tracker.php';
        require_once $base_path . 'includes/woocommerce/class-woocommerce-cart-tracker.php';
        require_once $base_path . 'includes/woocommerce/class-woocommerce-integration.php';

        require_once $base_path . 'includes/admin/class-admin-settings.php';
    }

    private static function init_components()
    {
        Dori_Chatbot_Cache_Manager::init();
        Dori_Chatbot_Public_API::init();
        Dori_Chatbot_Gateland_API::init();
        Dori_Chatbot_Admin_UI_API::init();
        Dori_Chatbot_WooCommerce_Integration::init();

        if (is_admin()) {
            Dori_Chatbot_Admin_Settings::init();
        }
    }
}
