<?php
/**
 * Plugin Name: CarDealerPress
 * Plugin URI: https://www.cardealerpress.com/
 * Author: DealerTrend
 * Author URI: https://www.dealertrend.com
 * Description: Provides access to the Vehicle Management System provided by <a href="https://www.dealertrend.com" target="_blank" title="DealerTrend, Inc: Shift Everything">DealerTrend, Inc.</a>
 * Version: 7.0.2606.01
 * Requires at least: 6.0
 * Requires PHP: 7.4
 * License: GPLv2 or later
 */

/*
CarDealerPress is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
any later version.
CarDealerPress is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CarDealerPress. If not, see https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html.
*/

namespace CarDealerPress;

use CarDealerPress\includes\functions\CarDealerPress;
use CarDealerPress\Includes\Init\Activator;
use CarDealerPress\Includes\Init\Constant;
use CarDealerPress\Includes\Uninstall\Deactivator;
use CarDealerPress\Includes\Uninstall\Uninstall;

/**
 * If this file is called directly, then abort execution.
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
if ( ! defined( 'CDP_DIR_PATH' ) ) {
	define( 'CDP_DIR_PATH', plugin_dir_path( __FILE__ ) );
}
/*Define Autoloader class for plugin*/
$autoloader_path = 'includes/class-autoloader.php';
/**
* Include autoloader class to load all classes inside this plugin
*/
require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . $autoloader_path;
/*Define required constant for plugin*/
Constant::define_constant();

function cdp_activate( $network_wide ) {
	( new Activator() )->cdp_activate( $network_wide );
}
register_activation_hook(
	__FILE__,
	__NAMESPACE__ . '\cdp_activate'
);

function deactivate( $network_wide ) {
	( new Deactivator() )->deactivate( $network_wide );
}
register_deactivation_hook(
	__FILE__,
	__NAMESPACE__ . '\deactivate'
);

// public static function instance(): CarDealerPress {
// if ( is_null( ( self::$instance ) ) ) {
// self::$instance = new self();
// }
//
// return self::$instance;
// }
function run_cardealerpress(): void {
	 $cardealerpress = new CarDealerPress();
	 $cardealerpress->run();
}

run_cardealerpress();
