<?php
/**
 * Plugin Name: Failed Order Rescue for WooCommerce Pro
 * Description: Recover failed and pending WooCommerce orders with payment-link emails, lost revenue reporting, and recovery tracking.
 * Version: 0.2.0
 * Author: VKCT
 * Text Domain: failed-order-rescue-for-woocommerce
 * Domain Path: /languages
 * Requires at least: 6.4
 * Requires PHP: 7.4
 * Requires Plugins: woocommerce
 * WC requires at least: 8.0
 * WC tested up to: 9.9
 * License: GPLv2 or later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 *
 * @package FailedOrderRescueForWooCommerce
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

define( 'FORD_VERSION', '0.2.0' );
define( 'FORD_PLUGIN_FILE', __FILE__ );
define( 'FORD_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'FORD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'FORD_TEXT_DOMAIN', 'failed-order-rescue-for-woocommerce' );

/*
 * Replace these values if the Freemius dashboard product snippet shows different values.
 * Product setup: Pro plan, 1-site license, $5/month, 7-day trial.
 */
define( 'FORD_FREEMIUS_ID', 19560 );
define( 'FORD_FREEMIUS_PUBLIC_KEY', 'pk_70002d60a22da1b83e8261f3cec89' );

require_once FORD_PLUGIN_DIR . 'includes/class-ford-freemius.php';
require_once FORD_PLUGIN_DIR . 'includes/class-ford-plugin.php';
require_once FORD_PLUGIN_DIR . 'includes/class-ford-settings.php';
require_once FORD_PLUGIN_DIR . 'includes/class-ford-orders.php';
require_once FORD_PLUGIN_DIR . 'includes/class-ford-email.php';
require_once FORD_PLUGIN_DIR . 'includes/class-ford-pro.php';
require_once FORD_PLUGIN_DIR . 'includes/class-ford-admin.php';

register_activation_hook( __FILE__, array( 'FORD_Plugin', 'activate' ) );
register_activation_hook( __FILE__, array( 'FORD_Pro', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'FORD_Pro', 'deactivate' ) );

add_action(
	'before_woocommerce_init',
	static function () {
		if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
			\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
		}
	}
);

add_action(
	'plugins_loaded',
	static function () {
		FORD_Freemius::init();
		FORD_Plugin::instance()->init();
	}
);
