<?php

namespace ONLINE_ADAv4;

use ONLINE_ADAv4\Api\Admin AS ApiAdmin;
use ONLINE_ADAv4\Menus;

class Plugin
{

	/**
     * Info about the plugin e.g. Version number and File path
     *
     * @var array
     */
    public $info;

    /**
     * Instantiation of the License Check class, responsible for creating the license page and managing the license
     *
     * @var array
     */

    public $fpc;

    /**
     * Admin rest api initialization
     *
     * @var array
     */
    public $adminApi;

	/**
	 * Plugin instance for use throughout plugin
	 *
	 * @var Plugin
	 */
	public static $instance = null;

	public static function instance($info = [])
	{
		if (is_null(self::$instance)) {
			self::$instance = new self($info);
		}

		return self::$instance;
	}

	private function __construct($info)
	{
		$this->info = $info;

		if (!file_exists($this->info["path"] . "vendor/autoload.php")) return;
		require_once $this->info["path"] . "vendor/autoload.php";
		
		$this->adminApi = ApiAdmin::getInstance();

		new Menus();
	}
}