<?php
/**
 * ZERTI plugin module loader.
 *
 * @package ZERTI
 * @license GPL-2.0-or-later
 * @link    https://www.gnu.org/licenses/gpl-2.0.html
 *
 * Copyright (C) 2026 ZERTI Plugins
 */

if (!defined('ABSPATH')) {
    exit;
}

/**
 * @return string Absolute path to includes/.
 */
function zerti_includes_path(): string
{
    return plugin_dir_path(ZERTI_PLUGIN_FILE) . 'includes/';
}

/**
 * @param string $relative Path relative to includes/.
 */
function zerti_require_include(string $relative): void
{
    require_once zerti_includes_path() . ltrim($relative, '/');
}

// Core helpers (WooCommerce, formatting, invoices).
zerti_require_include('i18n.php');
zerti_require_include('zerti-wc-coupon-i18n.php');
zerti_require_include('zerti-functions.php');
zerti_require_include('ui/primitives.php');
zerti_require_include('capabilities.php');
zerti_require_include('zerti-product-categories.php');
zerti_require_include('zerti-product-tags.php');
zerti_require_include('zerti-product-brands.php');
zerti_require_include('zerti-product-reviews.php');
zerti_require_include('zerti-product-attributes.php');
zerti_require_include('zerti-product-attribute-groups.php');
zerti_require_include('zerti-product-import-export.php');
zerti_require_include('zerti-wc-coupons.php');

// Data / grids / partial renders (before shell — nav badge uses order counts).
zerti_require_include('zerti-components.php');
zerti_require_include('zerti-wc-home-stats.php');
zerti_require_include('zerti-wc-analytics-leaderboards.php');

// Admin UI, assets, settings.
zerti_require_include('admin/assets.php');
zerti_require_include('admin/shell.php');
zerti_require_include('admin/edition-footer-free.php');
zerti_require_include('admin/notes.php');
zerti_require_include('admin/themes.php');
zerti_require_include('admin/settings.php');
zerti_require_include('grids/queries.php');
zerti_require_include('grids/sales-report.php');
zerti_require_include('grids/products.php');
zerti_require_include('zerti-product-edit.php');
zerti_require_include('zerti-shop-order-actions.php');
zerti_require_include('zerti-pdf-bootstrap.php');
zerti_require_include('rest/api.php');

// AJAX component loader + hooks.
zerti_require_include('ajax/components.php');
zerti_require_include('ajax/product-categories.php');
zerti_require_include('ajax/product-tags.php');
zerti_require_include('ajax/product-brands.php');
zerti_require_include('ajax/product-reviews.php');
zerti_require_include('ajax/product-attributes.php');
zerti_require_include('ajax/product-attribute-groups.php');
zerti_require_include('ajax/wc-coupons.php');
zerti_require_include('global-search.php');
zerti_require_include('hooks.php');
