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

/**
 * KNSDD_Ajax Class
 *
 * Main AJAX handler for the plugin.
 * This class loads and initializes all modular AJAX handler classes.
 */
class KNSDD_Ajax {
    
    public function __construct() {
        $this->load_handlers();
    }

    /**
     * Loads all the individual AJAX handler files and initializes their classes.
     */
    private function load_handlers() {
        $handler_path = __DIR__ . '/ajax/';

        require_once $handler_path . 'class-knsdd-ajax-groups.php';
        require_once $handler_path . 'class-knsdd-ajax-rules.php';
        require_once $handler_path . 'class-knsdd-ajax-search.php';
        require_once $handler_path . 'class-knsdd-ajax-promos.php';

        new KNSDD_Ajax_Groups();
        new KNSDD_Ajax_Rules();
        new KNSDD_Ajax_Search();
        new KNSDD_Ajax_Promos();
    }
}
