<?php
/**
 * File Path: includes/api/license/class-mbs-license-notices.php
 *
 * License-related admin notices.
 *
 * @package MyBookShowroom
 * @since   1.3.5
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class MBS_License_Notices {

	/**
	 * Register the license activation warning admin notice hook.
	 *
	 * @return void
	 * @since 1.3.5
	 */
	public static function register_hooks(): void {
		add_action( 'admin_notices', array( __CLASS__, 'show_activation_warning' ) );
	}

	/**
	 * Show admin notice when a license key is stored but not yet activated.
	 *
	 * Only fires for key-stored-but-unactivated state. Keyless installs return true
	 * from mbs_is_registered() so this notice is suppressed for them (WO-002).
	 *
	 * @return void
	 */
	public static function show_activation_warning(): void {
		if ( ! mbs_is_registered() ) {
			?>
			<div class="notice notice-error">
				<p>
					<strong>My Book Showroom is not yet activated.</strong>
					Front-end book display is disabled until your license key is activated.
					<a href="<?php echo esc_url( admin_url( 'admin.php?page=my-book-showroom-settings&tab=license' ) ); ?>">Activate your license &rarr;</a>
				</p>
			</div>
			<?php
		}
	}
}
