<?php
/**
 * ═══════════════════════════════════════════════════════════════════════
 *  STARTUP HUB — Integration Patch for damalion-blog-ai.php
 * ═══════════════════════════════════════════════════════════════════════
 *
 *  This file documents ALL changes needed in the main plugin file.
 *  Apply these changes to damalion-blog-ai.php to enable the Startup Hub module.
 *
 *  CHANGES REQUIRED:
 *
 *  1. In dba_init_plugin() — Add require_once lines (after LATAM block)
 *  2. In dba_init_plugin() — Add instance initialization (after LATAM instances)
 *  3. In dba_init_plugin() — Add admin class loading (after LATAM admin)
 *  4. In DBA_Conflict_Center::MODULES — Add 'startup_hub' entry
 *  5. In activation/deactivation hooks — Add scheduler calls
 *
 * ═══════════════════════════════════════════════════════════════════════
 */

// ─────────────────────────────────────────────────────────────────────
// CHANGE 1: Add to dba_init_plugin() after the LATAM block (~line 360)
//
// FIND THIS LINE:
//     define( 'DBA_LATAM_LOADED', true );
// }
//
// ADD AFTER IT:
// ─────────────────────────────────────────────────────────────────────

    // --- Startup Hub module — U.S. Startup Ecosystem articles (isolated) ---
    if ( file_exists( DBA_PLUGIN_DIR . 'startup-hub/class-startup-hub-registry.php' ) ) {
        require_once DBA_PLUGIN_DIR . 'startup-hub/class-startup-hub-registry.php';
        require_once DBA_PLUGIN_DIR . 'startup-hub/class-startup-hub-dedupe.php';
        require_once DBA_PLUGIN_DIR . 'startup-hub/class-startup-hub-validator.php';
        require_once DBA_PLUGIN_DIR . 'startup-hub/class-startup-hub-kaizen.php';
        require_once DBA_PLUGIN_DIR . 'startup-hub/class-startup-hub-homepage-filter.php';
        require_once DBA_PLUGIN_DIR . 'startup-hub/class-startup-hub-anti-orphan.php';
        require_once DBA_PLUGIN_DIR . 'startup-hub/class-startup-hub-generator.php';
        require_once DBA_PLUGIN_DIR . 'startup-hub/class-startup-hub-scheduler.php';
        define( 'DBA_STARTUP_HUB_LOADED', true );
    }


// ─────────────────────────────────────────────────────────────────────
// CHANGE 2: Add admin class loading in the is_admin() block (~line 377)
//
// FIND THIS LINE:
//     if ( defined( 'DBA_LATAM_LOADED' ) && DBA_LATAM_LOADED ) {
//         require_once DBA_PLUGIN_DIR . 'latam/class-latam-admin.php';
//         DBA_LATAM_Admin::get_instance();
//         DBA_LATAM_Calendar::get_instance();
//     }
//
// ADD AFTER IT:
// ─────────────────────────────────────────────────────────────────────

        if ( defined( 'DBA_STARTUP_HUB_LOADED' ) && DBA_STARTUP_HUB_LOADED ) {
            require_once DBA_PLUGIN_DIR . 'startup-hub/class-startup-hub-admin.php';
            DBA_Startup_Hub_Admin::get_instance();
        }


// ─────────────────────────────────────────────────────────────────────
// CHANGE 3: Add instance initialization after LATAM instances (~line 415)
//
// FIND THIS LINE:
//     if ( defined( 'DBA_LATAM_LOADED' ) && DBA_LATAM_LOADED ) {
//         DBA_LATAM_Scheduler::get_instance();
//         DBA_LATAM_Shortcodes::get_instance();
//     }
//
// ADD AFTER IT:
// ─────────────────────────────────────────────────────────────────────

    // --- Startup Hub instances ---
    if ( defined( 'DBA_STARTUP_HUB_LOADED' ) && DBA_STARTUP_HUB_LOADED ) {
        DBA_Startup_Hub_Generator::get_instance();
        DBA_Startup_Hub_Scheduler::get_instance();
        DBA_Startup_Hub_Homepage_Filter::get_instance();
        DBA_Startup_Hub_Anti_Orphan::get_instance();
    }


// ─────────────────────────────────────────────────────────────────────
// CHANGE 4: Add to DBA_Conflict_Center::MODULES constant
//
// In class-conflict-center.php, find:
//     'live_sports'   => 'Live Sports AI',
//
// ADD AFTER IT:
//     'startup_hub'   => 'Startup Hub (US)',
// ─────────────────────────────────────────────────────────────────────


// ─────────────────────────────────────────────────────────────────────
// CHANGE 5: Plugin activation/deactivation hooks
//
// If you have register_activation_hook / register_deactivation_hook
// in the main plugin file, add these calls inside them:
// ─────────────────────────────────────────────────────────────────────

// In activation hook:
//     if ( class_exists( 'DBA_Startup_Hub_Scheduler' ) ) {
//         DBA_Startup_Hub_Scheduler::activate();
//     }

// In deactivation hook:
//     if ( class_exists( 'DBA_Startup_Hub_Scheduler' ) ) {
//         DBA_Startup_Hub_Scheduler::deactivate();
//     }
