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

require_once __DIR__ . '/config/config.php';
require_once __DIR__ . '/neurogenesis-theme/Autoload.php';
require_once __DIR__ . '/neurogenesis-theme/Helpers/Array.php';
require_once __DIR__ . '/neurogenesis-theme/Helpers/URL.php';
require_once __DIR__ . '/neurogenesis-theme/Helpers/Registry.php';
require_once __DIR__ . '/neurogenesis-theme/Helpers/FlashMessages.php';
require_once __DIR__ . '/neurogenesis-theme/Helpers/SVGIcons.php';

$neurogenesis_theme_var_names = [
    // Post meta only — site settings live in ThemeOptions (`thinko_options`).
    'meta_content_imported' => '_neurogenesis_theme_imported',
];

neurogenesis_theme_registry_set('neurogenesis_theme.var_names', $neurogenesis_theme_var_names);

add_action(
    'after_setup_theme',
    static function (): void {
        \NeurogenesisTheme\Helpers\ThemeOptions::migrate_legacy();
    },
    1
);

// Notice design mode (any wp-admin screen; dismiss is not saved in debug).
// add_filter( 'neurogenesis_theme_onboarding_debug', '__return_true' );
// add_filter( 'neurogenesis_theme_rating_debug', '__return_true' );

add_action(
    'admin_init',
    static function (): void {
        if (!is_user_logged_in() || !current_user_can('edit_theme_options')) {
            return;
        }
        if (!empty($_GET['neurogenesis_theme_onboarding_debug'])) {
            add_filter('neurogenesis_theme_onboarding_debug', '__return_true');
        }
        if (!empty($_GET['neurogenesis_theme_rating_debug'])) {
            add_filter('neurogenesis_theme_rating_debug', '__return_true');
        }
    },
    1
);


require_once NEUROGENESIS_THEME_PATH . '/boot.php';

require_once __DIR__ . '/inc/pattern-loader.php';