<?php

/**
 * Plugin Name: CAWL
 * Description: CAWL.
 * Version:     2.5.1
 * SHA:        6a11480
 * Requires at least: 6.3
 * Requires PHP: 7.4
 * Requires Plugins: woocommerce
 * WC requires at least: 8.6
 * WC tested up to: 9.5
 * Author:      CAWL
 * Author URI:  https://www.cawl.fr/
 * Text Domain: cawl-for-woocommerce
 * Domain Path: /languages
 */

declare(strict_types=1);

namespace Inpsyde\WorldlineForWoocommerce;

use Inpsyde\Modularity\Package;
use Syde\Vendor\Cawl\Inpsyde\WorldlineForWoocommerce\Plugin;

require_once __DIR__ . '/class-plugin.php';

if (is_readable(dirname(__FILE__) . '/vendor/autoload.php')) {
    include_once dirname(__FILE__) . '/vendor/autoload.php';
}

add_action('plugins_loaded', static function (): void {
    static $package;

    if (!$package) {
        /** @var callable $bootstrap */
        $bootstrap = require __DIR__ . '/inc/bootstrap.php';
        $onError = require __DIR__ . '/inc/error.php';
        $modules = (require __DIR__ . '/inc/modules.php')();
        $modules = apply_filters('wlop.modules_list', $modules);

        $package = $bootstrap(
            __FILE__,
            $onError,
            ...$modules
        );
        do_action('wlop.plugin_init');
    }
}, 5);

global $wpdb;
Plugin::instance($wpdb, __FILE__);
