<?php
/**
 * Plugin Name: Plugoza Event Ticketing
 * Description: Create events, sell tickets, manage bookings, send PDF tickets, and verify ticket QR codes.
 * Version: 1.0
 * Requires at least: 6.2
 * Requires PHP: 8.4
 * Author: plugoza.com
 * Author URI: https://plugoza.com
 * License: GPL-2.0-or-later
 * Text Domain: plugoza-event-ticketing
 * Domain Path: /languages
 */

defined( 'ABSPATH' ) || exit;

define( 'PLUGOZA_ETT_VERSION', '1.0' );
define( 'PLUGOZA_ETT_FILE', __FILE__ );
define( 'PLUGOZA_ETT_PATH', plugin_dir_path( __FILE__ ) );
define( 'PLUGOZA_ETT_URL', plugin_dir_url( __FILE__ ) );

if ( file_exists( PLUGOZA_ETT_PATH . 'vendor/autoload.php' ) ) {
	require_once PLUGOZA_ETT_PATH . 'vendor/autoload.php';
}

spl_autoload_register(
	static function ( $class ) {
		$prefix = 'PlugozaEventTicketing\\';
		if ( 0 !== strpos( $class, $prefix ) ) { return; }
		$file = PLUGOZA_ETT_PATH . 'includes/' . str_replace( array( $prefix, '\\' ), array( '', '/' ), $class ) . '.php';
		if ( file_exists( $file ) ) { require $file; }
	}
);

register_activation_hook( __FILE__, array( 'PlugozaEventTicketing\\Database\\Installer', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'PlugozaEventTicketing\\Plugin', 'deactivate' ) );

add_action( 'plugins_loaded', static function () {
	\PlugozaEventTicketing\Plugin::instance()->run();
} );
