<?php
/**
 * UX Loader
 *
 * Central loader for all user-experience related classes.
 * Add new UX feature files here as the plugin grows
 * (e.g. onboarding, rating prompt, welcome screen).
 *
 * @package    captain-widgets-kit
 * @subpackage captain-widgets-kit/includes/admin/ux
 * @since      1.0.0
 */

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

if ( ! class_exists( 'Captwiki_UX_Loader' ) ) {

	/**
	 * Captwiki_UX_Loader
	 *
	 * Bootstraps all UX feature classes. Each feature lives in its own
	 * file inside the /ux/ folder and is included here. This keeps
	 * class-captwiki-load.php clean — only one line needed to boot
	 * all UX functionality.
	 *
	 * @since 1.0.0
	 */
	class Captwiki_UX_Loader {

		/**
		 * Singleton instance.
		 *
		 * @since 1.0.0
		 * @var Captwiki_UX_Loader
		 */
		private static $instance;

		/**
		 * Initiator — returns the single instance.
		 *
		 * @since  1.0.0
		 *
		 * @return Captwiki_UX_Loader
		 */
		public static function get_instance() {
			if ( ! isset( self::$instance ) ) {
				self::$instance = new self();
			}
			return self::$instance;
		}

		/**
		 * Constructor — load all UX feature files.
		 *
		 * @since 1.0.0
		 */
		public function __construct() {
			$this->load_features();
		}

		/**
		 * Include all UX feature class files.
		 *
		 * Add a new include here whenever a new UX feature is introduced.
		 *
		 * @since  1.0.0
		 *
		 * @return void
		 */
		private function load_features() {
			// Deactivation feedback — AJAX proxy to Captain Data API.
			include_once CAPTWIKI_PATH . 'includes/admin/ux/class-captwiki-deactivate-ajax.php';

			// Deactivation feedback — modal HTML and asset enqueue.
			include_once CAPTWIKI_PATH . 'includes/admin/ux/class-captwiki-deactivate-feedback.php';

			// Onboarding — dismiss AJAX handler + Captain Data API proxy.
			include_once CAPTWIKI_PATH . 'includes/admin/ux/class-captwiki-onboarding-ajax.php';
		}
	}

	Captwiki_UX_Loader::get_instance();
}
