<?php
/**
 * Mobile App admin menu (free preview — no pairing functionality).
 *
 * @package APBGF.
 */

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

if ( ! class_exists( 'APBGF_Mobile_App' ) ) {

	class APBGF_Mobile_App {

		private static $instance = null;

		private function __construct() {
			add_action( 'apbgf_after_menu_register', array( $this, 'register_menu' ) );
		}

		public function register_menu() {
			$badge_style = 'background:#ef4444; color:#ffffff; border-radius:10px; padding:1px 8px; font-size:9px; margin-left:4px; font-weight:bold; vertical-align:middle;';
			$menu_title  = __( 'Mobile App', 'appointment-and-booking-for-gravity-forms' )
				. ' <span class="dashicons dashicons-smartphone" style="font-size: 17px; vertical-align: middle;"></span>'
				. ' <span style="' . esc_attr( $badge_style ) . '">New</span>';

			add_submenu_page(
				'appointment-and-booking-for-gravity-forms',
				__( 'Mobile App', 'appointment-and-booking-for-gravity-forms' ),
				$menu_title,
				'manage_options',
				'apbgf-mobile-app',
				array( get_class( $this ), 'render_page' ),
				100
			);
		}

		public static function render_page() {
			require_once APBGF_ADMIN_VIEW_PATH . 'mobile-app.php';
		}

		public static function get_instance() {
			if ( null === self::$instance ) {
				self::$instance = new APBGF_Mobile_App();
			}
			return self::$instance;
		}
	}

	APBGF_Mobile_App::get_instance();
}
