<?php
/**
 * Main plugin orchestrator.
 *
 * @package AccessLens
 */

declare(strict_types=1);

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

/**
 * AccessLens_Plugin — singleton entry point.
 */
final class AccessLens_Plugin {

	/** @var AccessLens_Plugin|null */
	private static ?AccessLens_Plugin $instance = null;

	/** @var AccessLens_Admin */
	private AccessLens_Admin $admin;

	/** @var AccessLens_Ajax */
	private AccessLens_Ajax $ajax;

	private function __construct() {
		$this->admin = new AccessLens_Admin();
		$this->ajax  = new AccessLens_Ajax( new AccessLens_Engine_Client() );

		$this->admin->register();
		$this->ajax->register();
		// Nota: no se llama a load_plugin_textdomain(): WordPress.org carga las
		// traducciones del slug automaticamente desde WP 4.6.
	}

	/**
	 * Get or create singleton instance.
	 */
	public static function get_instance(): self {
		if ( null === self::$instance ) {
			self::$instance = new self();
		}
		return self::$instance;
	}

}
