<?php
/**
 * Shared helper functions for Antimanual Builder.
 *
 * @package Antimanual_Builder
 */

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

if ( ! function_exists( 'ambld_is_pro' ) ) {
	/**
	 * Whether the Antimanual Builder Pro build is active and licensed.
	 *
	 * `AMBLD_PRO` is defined in ambld_init() only when Freemius reports usable
	 * premium code AND the Pro plugin's bootstrap class (`AMBLD_Pro`) is loaded.
	 * Mirrors the parent Antimanual plugin's atml_is_pro().
	 *
	 * @return bool True when Pro features are unlocked.
	 */
	function ambld_is_pro() {
		return (bool) ( defined( 'AMBLD_PRO' ) && AMBLD_PRO );
		
	}
}

if ( ! function_exists( 'ambld_pro_upgrade_url' ) ) {
	/**
	 * Freemius upgrade/pricing URL, used for locked-feature upgrade CTAs.
	 *
	 * Returns an empty string when Freemius is not initialized (e.g. before the
	 * SDK is installed or credentials are set), so callers can guard on it.
	 *
	 * @return string
	 */
	function ambld_pro_upgrade_url() {
		if ( function_exists( 'ab_fs' ) ) {
			return (string) ab_fs()->get_upgrade_url();
		}

		return '';
	}
}
