<?php
/**
 * Wemeet Admin Notices Handler
 *
 * Handles admin notices for Webex configuration and other admin alerts.
 *
 * @package SOVLIX\WEMEET\Admin
 */

namespace SOVLIX\WEMEET\Admin;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Wemeet_Admin_Notices Class
 *
 * Manages admin notices and alerts.
 *
 * @since 1.0.0
 */
class Wemeet_Admin_Notices {

	/**
	 * Constructor.
	 */
	public function __construct() {
		add_action( 'admin_notices', array( $this, 'display_webex_config_notice' ) );
	}

	/**
	 * Display admin notice for Webex configuration.
	 *
	 * @return void
	 */
	public function display_webex_config_notice() {
		// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Admin page check only.
		$current_page = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : '';
		// phpcs:enable WordPress.Security.NonceVerification.Recommended

		// Only show on wemeet settings page.
		if ( 'wemeet-settings' !== $current_page ) {
			return;
		}

		// Check if Webex is configured.
		if ( Wemeet_Config_Manager::is_webex_auth_prepared() ) {
			return;
		}

		// Display configuration notice.
		?>
		<div class="notice notice-warning is-dismissible">
			<p>
				<?php esc_html_e( 'Please configure the Webex Auth credentials to enable additional Webex Client.', 'wemeet' ); ?>
				<a href="<?php echo esc_url( 'https://youtu.be/vV3EwUNJusk' ); ?>" target="_blank" rel="noopener noreferrer">
					<?php esc_html_e( 'Configure Webex Settings', 'wemeet' ); ?>
				</a>
			</p>
		</div>
		<?php
	}
}
