<?php

namespace Macymed\MacymedLinkTracker\Plugin;

use Macymed\MacymedLinkTracker\Admin\RegisterAdmin;
use Macymed\MacymedLinkTracker\Utils\Assets;
use Macymed\MacymedLinkTracker\Utils\Chart;
use Macymed\MacymedLinkTracker\Utils\Database;
use Macymed\MacymedLinkTracker\Utils\Redirect;
use Macymed\MacymedLinkTracker\Utils\Stats;
use Macymed\MacymedLinkTracker\Utils\Tracking;
use Macymed\MacymedLinkTracker\Utils\Report;
use Macymed\MacymedLinkTracker\Utils\Settings;
use Macymed\MacymedLinkTracker\Utils\Statistics;

if (! defined('ABSPATH')) {
    exit; // Sécurité
}

class RegisterPlugin
{
    /**
     * Holds the class instance.
     *
     * @var RegisterPlugin $instance
     */
    private static $instance = null;

    /**
     * Return an instance of the class
     *
     * Return an instance of the RegisterPlugin Class.
     *
     * @since 1.0.0
     *
     * @return RegisterPlugin class instance.
     */
    public static function get_instance()
    {
        if (null === self::$instance) {
            self::$instance = new self();
        }
        return self::$instance;
    }
    public function init()
    {

        Report::init();
        Chart::init();
        Settings::init();
        Stats::get_instance();
        
        if (! is_admin()) {
            
            Tracking::init();
            Assets::init();
            Redirect::init();
        } else {
            Database::init();
            RegisterAdmin::run();
        }
    }
}
