<?php 
/**
 * @var ST_ProQyz_License_Manager
 */
class ST_ProQyz_License_Manager{
    /**
	 * License version.
	 *
	 * @var string
	 */
	public $version = '1.0.0';

    protected static $_instance = null;

    /**
	 * Main License Instance.
	 *
	 * Ensures only one instance of License is loaded or can be loaded.
	 *
	 * @since 1.0
	 * @static
	 * @see ST()
	 * @return License - Main instance.
	 */
	public static function instance() {
		if ( is_null( self::$_instance ) ) {
			self::$_instance = new self();
		}
		return self::$_instance;
	}


    public function __construct() {
        $this->define_constants();
		$this->includes();
		$this->init_hooks();
		
    }



    /**
	 * Define ST Constants.
	 */
	private function define_constants() {
		
		$this->define( 'ST_PROQYZ_LICENSE_ABSPATH', dirname( ST_PROQYZ_LICENSE_MANAGER_PLUGIN_FILE ) . '/' );
		$this->define( 'ST_PROQYZ_LICENSE_PLUGIN_BASENAME', plugin_basename(ST_PROQYZ_LICENSE_MANAGER_PLUGIN_FILE ) );
		$this->define( 'ST_PROQYZ_LICENSE_VERSION', $this->version );

	}


	private function includes() {
		# rest apis
		include_once ST_PROQYZ_LICENSE_ABSPATH . "includes/class-st-wc-rest-apis.php";
		# requests
		include_once ST_PROQYZ_LICENSE_ABSPATH . "includes/class-st-requests.php";
		# ajax call backs
		include_once ST_PROQYZ_LICENSE_ABSPATH . "includes/admin/admin-ajax/st-proqyz-license-ajax.php";
		# oauth integration
		include_once ST_PROQYZ_LICENSE_ABSPATH . "includes/class-st-oauth.php";
		# include woocommerce integration with products category
		include_once ST_PROQYZ_LICENSE_ABSPATH . "includes/class-st-wc-post-integration.php";
		include_once ST_PROQYZ_LICENSE_ABSPATH . "includes/class-st-wc-order-integration.php";
	}


	private function init_hooks() {
		add_action( 'admin_enqueue_scripts', [$this, 'enqueue_scripts'] );
	}


    /**
	 * Define constant if not already set.
	 *
	 * @param string      $name  Constant name.
	 * @param string|bool $value Constant value.
	 */
	private function define( $name, $value ) {
		if ( ! defined( $name ) ) {
			define( $name, $value );
		}
	}

	/**
	 * Register the JavaScript for the public-facing side of the site.
	 *
	 * @since    1.0.0
	 */
	public function enqueue_scripts() {
		/**
		 * This function is provided for demonstration purposes only.
		 *
		 * An instance of this class should be passed to the run() function
		 * defined in Ielts_Lms_Loader as all of the hooks are defined
		 * in that particular class.
		 *
		 * The Ielts_Lms_Loader will then create the relationship
		 * between the defined hooks and the functions defined in this
		 * class.
		 */
		$plugin_url  = plugin_dir_url( ST_PROQYZ_LICENSE_MANAGER_PLUGIN_FILE );
		wp_enqueue_script('st-proqyz-license-main-js', $plugin_url . '/includes/admin/dist/js/spacetree-proqyz-license-main.js', array('jquery'), '1.0', true);
	}

}


return ST_ProQyz_License_Manager::instance();