<?php
/**
 * Plugin bootstrap.
 *
 * @package LocalGuardScanner
 */

namespace LocalGuardScanner;

use LocalGuardScanner\Application\Compatibility;
use LocalGuardScanner\Application\Lifecycle\Activator;
use LocalGuardScanner\Application\Lifecycle\Deactivator;
use LocalGuardScanner\Infrastructure\WordPress\Capabilities;

/**
 * Wires WordPress hooks without performing scan work during file loading.
 */
final class Bootstrap {
	/**
	 * Register plugin hooks.
	 *
	 * @return void
	 */
	public static function boot() {
		register_activation_hook( LOCALGUARD_SCANNER_FILE, array( Activator::class, 'activate' ) );
		register_deactivation_hook( LOCALGUARD_SCANNER_FILE, array( Deactivator::class, 'deactivate' ) );

		add_action( 'plugins_loaded', array( self::class, 'load_textdomain' ) );
		add_action( 'plugins_loaded', array( Plugin::class, 'initialize' ), 20 );
		add_action( 'admin_init', array( Compatibility::class, 'register_admin_notice' ) );
		add_action( 'init', array( Capabilities::class, 'ensure_registered' ) );
	}

	/**
	 * Load translations.
	 *
	 * @return void
	 */
	public static function load_textdomain() {
		load_plugin_textdomain(
			'localguard-scanner',
			false,
			dirname( plugin_basename( LOCALGUARD_SCANNER_FILE ) ) . '/languages'
		);
	}
}
