<?php
/**
 * Sifency AI — Integration Snippet
 *
 * Add the lines below to your main plugin's `load_components()` method
 * (inside Sifency_Addons class, in `base/sifency-class.php`).
 *
 * The AI module is loaded AFTER Elementor is confirmed active so
 * the widget injection filter fires at the right time.
 *
 * -----------------------------------------------------------------------
 * HOW TO INTEGRATE
 * -----------------------------------------------------------------------
 *
 * 1. Drop the `sifency-ai/` folder into `classes/admin-module/`.
 *
 * 2. In `base/sifency-class.php`, inside `load_components()`, add:
 *
 *    // ── Sifency AI ─────────────────────────────────────────────────
 *    add_action( 'plugins_loaded', function () {
 *        if ( is_admin() || did_action( 'elementor/loaded' ) ) {
 *            require_once SIFENCY_ADDONS_DIR . 'classes/admin-module/sifency-ai/class-ai-module.php';
 *            Sifency_Addons_AI_Module::instance();
 *        }
 *    }, 20 );
 *
 * 3. That's it. The module self-registers:
 *    - Admin submenu page under "Sifency Addons → AI Studio"
 *    - AJAX handlers
 *    - Filter hooks (sifency_addons_widget_list, sifency_addons_admin_module_files)
 *    - Dynamic loader for generated files
 *
 * -----------------------------------------------------------------------
 * DIRECTORY STRUCTURE (final)
 * -----------------------------------------------------------------------
 *
 * classes/admin-module/sifency-ai/
 * ├── class-ai-module.php            ← Main bootstrap + AJAX dispatcher
 * ├── class-ai-api.php               ← OpenAI / Anthropic API handler
 * ├── class-ai-file-writer.php       ← Write / toggle / delete / list files
 * ├── class-ai-prompt-engine.php     ← System + user prompts per generator type
 * ├── class-ai-widget-generator.php  ← Widget generation pipeline
 * ├── class-ai-loader.php            ← Dynamic file loader via Sifency filters
 * └── assets/
 *     ├── ai-panel.css               ← Admin UI styles
 *     └── ai-panel.js                ← Admin UI (vanilla JS)
 *
 * Generated files land in:
 *   wp-content/uploads/sifency-ai/
 *   ├── widgets/         ← Elementor widgets (.php)
 *   ├── cpts/            ← Custom post types
 *   ├── builder-items/   ← Popup, topbar, etc.
 *   ├── menus/           ← Menu-related code
 *   ├── pages/           ← Page creators
 *   └── metaboxes/       ← Admin metaboxes
 *
 * -----------------------------------------------------------------------
 * EXTENDING — Adding a new generator (e.g. CPT)
 * -----------------------------------------------------------------------
 *
 * 1. Add a system prompt in class-ai-prompt-engine.php:
 *    public static function cpt_system(): string { ... }
 *    public static function cpt_user( string $prompt, string $slug ): string { ... }
 *
 * 2. Create class-ai-cpt-generator.php following the same pattern as
 *    class-ai-widget-generator.php (call API → clean → validate → write).
 *
 * 3. Add an AJAX case in class-ai-module.php:
 *    case 'sifency_ai_generate_cpt':
 *        $this->ajax_generate_cpt();
 *        break;
 *
 * 4. Add a require_once in load_dependencies().
 *
 * 5. Add a tab + form in assets/ai-panel.js.
 *
 * 6. The loader (class-ai-loader.php) already handles 'cpts' — no extra
 *    filter wiring needed for basic require_once loading.
 */
