<?php
	/**
	 * @package     Freemius
	 * @copyright   Copyright (c) 2015, Freemius, Inc.
	 * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
	 * @since       1.0.4
	 *
	 * NOTE: This is a no-op stub of the original STOREVOICEAI_FS_Plugin_Updater class.
	 * The original Freemius plugin updater is intentionally omitted from the
	 * WordPress.org distribution to comply with WordPress.org plugin guidelines,
	 * which prohibit third-party plugin update mechanisms. The full updater is
	 * only used by paid, self-hosted distributions of this plugin (where
	 * is_premium => true). On the WordPress.org build this class is never
	 * exercised at runtime because is_premium is set to false.
	 */

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

	if ( ! class_exists( 'STOREVOICEAI_FS_Plugin_Updater' ) ) {

		class STOREVOICEAI_FS_Plugin_Updater {

			const UPDATES_CHECK_CACHE_EXPIRATION = HOUR_IN_SECONDS;

			/**
			 * @var STOREVOICEAI_FS_Plugin_Updater[]
			 */
			private static $_instances = array();

			/**
			 * @var Freemius
			 */
			private $_fs;

			private function __construct( $freemius ) {
				$this->_fs = $freemius;
			}

			/**
			 * @param Freemius $freemius
			 *
			 * @return STOREVOICEAI_FS_Plugin_Updater
			 */
			public static function instance( $freemius ) {
				$key = is_object( $freemius ) && method_exists( $freemius, 'get_id' )
					? (string) $freemius->get_id()
					: spl_object_hash( $freemius );

				if ( ! isset( self::$_instances[ $key ] ) ) {
					self::$_instances[ $key ] = new self( $freemius );
				}

				return self::$_instances[ $key ];
			}

			/**
			 * No-op on the WordPress.org build.
			 */
			public function delete_update_data() {
				return;
			}

			/**
			 * No-op on the WordPress.org build. Defensive stub: callers
			 * (e.g. templates/account.php) only reach this path when Freemius
			 * has tracked an update for the site, which never happens on the
			 * WordPress.org build (is_premium => false), but the method is
			 * provided so any unguarded call resolves without a fatal.
			 */
			public function set_update_data( $new_version = null ) {
				return;
			}

			/**
			 * Not invoked on the WordPress.org build (is_premium => false guards
			 * the upstream callers). Returned shape matches the original API so
			 * any defensive caller in the SDK remains happy.
			 */
			public function install_and_activate_plugin( $plugin_id ) {
				return array();
			}

			/**
			 * Not invoked on the WordPress.org build. Kept as a stub so the
			 * add-on info dialog code path in the SDK can still reference it
			 * without a fatal error if it is ever reached.
			 */
			public static function _fetch_plugin_info_from_repository( $action, $args ) {
				return false;
			}
		}
	}
