<?php
/**
 * Plugin Name: Recast Paywall
 * Plugin URI: https://recastpay.com
 * Description: Monetize your content with Recast Paywall. Features automatic content synchronization, dual editor support, and comprehensive theme customization options.
 * Version: 0.0.30
 * Author: recastplugin
 * License: GPL v2 or later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: recast-paywall
 * Domain Path: /languages
 * Requires at least: 6.2
 * Tested up to: 6.8.3
 * Requires PHP: 8.0
 * Network: true
 * Stable tag: 0.0.30
 * Tags: paywall, content-gating, recast, premium-content, monetization, subscription, membership, gutenberg, blocks
 */

// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}

// Define plugin constants
define('RECAST_PAYWALL_VERSION', '0.0.30');
define('RECAST_PAYWALL_PLUGIN_FILE', __FILE__);
define('RECAST_PAYWALL_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('RECAST_PAYWALL_PLUGIN_URL', plugin_dir_url(__FILE__));
define('RECAST_PAYWALL_PLUGIN_BASENAME', plugin_basename(__FILE__));

// Autoloader
require_once RECAST_PAYWALL_PLUGIN_DIR . 'vendor/autoload.php';

// Initialize the plugin
add_action('plugins_loaded', function() {
    // Check minimum requirements
    if (version_compare(PHP_VERSION, '8.0', '<')) {
        add_action('admin_notices', function() {
            echo '<div class="notice notice-error"><p>' . 
                 esc_html__('Recast Paywall requires PHP 8.0 or higher.', 'recast-paywall') . 
                 '</p></div>';
        });
        return;
    }

    if (version_compare(get_bloginfo('version'), '6.2', '<')) {
        add_action('admin_notices', function() {
            echo '<div class="notice notice-error"><p>' . 
                 esc_html__('Recast Paywall requires WordPress 6.2 or higher.', 'recast-paywall') . 
                 '</p></div>';
        });
        return;
    }

    // Initialize the main plugin class
    \RecastPaywall\Plugin::getInstance();
});

// Activation hook
register_activation_hook(__FILE__, function() {
    \RecastPaywall\Plugin::activate();
});

// Deactivation hook
register_deactivation_hook(__FILE__, function() {
    \RecastPaywall\Plugin::deactivate();
});
