<?php
/**
 * PayPal Constants for BoostBot
 *
 * ⚠️ SECURITY NOTICE (Week 26+):
 * Do NOT store BoostMedia PayPal secrets in the WordPress plugin repository.
 * PayPal billing is backend-owned. This file is legacy and must not
 * contain real client IDs / secrets.
 *
 * @package BoostBot
 * @since 1.0.0
 */

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

/**
 * PayPal Mode
 * 
 * 'sandbox' - For testing (no real money)
 * 'live' - For production (real payments)
 * 
 * ⚠️ Change to 'live' before deploying to production!
 */
if (!defined('BOOSTBOT_PAYPAL_MODE')) {
    define('BOOSTBOT_PAYPAL_MODE', 'live');
}

/**
 * PayPal API Credentials (Boost Media's Business Account)
 * 
 * These are used to authenticate with PayPal API.
 * All subscription payments go to office@boost-media.co.il
 * 
 * Credentials are selected based on BOOSTBOT_PAYPAL_MODE
 */

// Sandbox Credentials (for testing)
if (!defined('BOOSTBOT_PAYPAL_SANDBOX_CLIENT_ID')) {
    define('BOOSTBOT_PAYPAL_SANDBOX_CLIENT_ID', '');
}
if (!defined('BOOSTBOT_PAYPAL_SANDBOX_SECRET')) {
    define('BOOSTBOT_PAYPAL_SANDBOX_SECRET', '');
}

// Live Credentials (for production)
if (!defined('BOOSTBOT_PAYPAL_LIVE_CLIENT_ID')) {
    define('BOOSTBOT_PAYPAL_LIVE_CLIENT_ID', '');
}
if (!defined('BOOSTBOT_PAYPAL_LIVE_SECRET')) {
    define('BOOSTBOT_PAYPAL_LIVE_SECRET', '');
}

// Active credentials based on mode
if (!defined('BOOSTBOT_PAYPAL_CLIENT_ID')) {
    define('BOOSTBOT_PAYPAL_CLIENT_ID', 
        BOOSTBOT_PAYPAL_MODE === 'sandbox' 
            ? BOOSTBOT_PAYPAL_SANDBOX_CLIENT_ID 
            : BOOSTBOT_PAYPAL_LIVE_CLIENT_ID
    );
}
if (!defined('BOOSTBOT_PAYPAL_SECRET')) {
    define('BOOSTBOT_PAYPAL_SECRET', 
        BOOSTBOT_PAYPAL_MODE === 'sandbox' 
            ? BOOSTBOT_PAYPAL_SANDBOX_SECRET 
            : BOOSTBOT_PAYPAL_LIVE_SECRET
    );
}

/**
 * PayPal Subscription Plan IDs
 * 
 * These are created in PayPal Developer Dashboard.
 * Each plan defines the price and billing cycle.
 * 
 * Plan IDs are different for Sandbox vs Live environments.
 */

// Sandbox Plan IDs (for testing)
if (!defined('BOOSTBOT_PAYPAL_SANDBOX_PLAN_ID_PRO')) {
    define('BOOSTBOT_PAYPAL_SANDBOX_PLAN_ID_PRO', 'P-XXXXXXXXXXXXXXX'); // legacy
}
if (!defined('BOOSTBOT_PAYPAL_SANDBOX_PLAN_ID_PRO_BUNDLES')) {
    define('BOOSTBOT_PAYPAL_SANDBOX_PLAN_ID_PRO_BUNDLES', 'P-XXXXXXXXXXXXXXX'); // legacy
}

// Live Plan IDs (legacy — subscriptions now handled by backend service)
if (!defined('BOOSTBOT_PAYPAL_LIVE_PLAN_ID_PRO')) {
    define('BOOSTBOT_PAYPAL_LIVE_PLAN_ID_PRO', 'P-XXXXXXXXXXXXXXX'); // legacy placeholder
}
if (!defined('BOOSTBOT_PAYPAL_LIVE_PLAN_ID_PRO_BUNDLES')) {
    define('BOOSTBOT_PAYPAL_LIVE_PLAN_ID_PRO_BUNDLES', 'P-XXXXXXXXXXXXXXX'); // legacy placeholder
}

// Active Plan IDs based on mode
if (!defined('BOOSTBOT_PAYPAL_PLAN_ID_PRO')) {
    define('BOOSTBOT_PAYPAL_PLAN_ID_PRO', 
        BOOSTBOT_PAYPAL_MODE === 'sandbox' 
            ? BOOSTBOT_PAYPAL_SANDBOX_PLAN_ID_PRO 
            : BOOSTBOT_PAYPAL_LIVE_PLAN_ID_PRO
    );
}
if (!defined('BOOSTBOT_PAYPAL_PLAN_ID_PRO_BUNDLES')) {
    define('BOOSTBOT_PAYPAL_PLAN_ID_PRO_BUNDLES', 
        BOOSTBOT_PAYPAL_MODE === 'sandbox' 
            ? BOOSTBOT_PAYPAL_SANDBOX_PLAN_ID_PRO_BUNDLES 
            : BOOSTBOT_PAYPAL_LIVE_PLAN_ID_PRO_BUNDLES
    );
}

/**
 * PayPal Webhook ID
 * 
 * Used to verify webhook signatures from PayPal.
 * 
 * To get this:
 * 1. Go to PayPal Developer Dashboard
 * 2. Navigate to Apps & Credentials → Your App
 * 3. Go to Webhooks → Add Webhook
 * 4. Set URL: https://YOUR-SITE.com/wp-json/boostbot/v1/subscription/webhook
 * 5. Select events: BILLING.SUBSCRIPTION.*, PAYMENT.SALE.*
 * 6. Copy the Webhook ID here
 */
// Sandbox Webhook ID
if (!defined('BOOSTBOT_PAYPAL_SANDBOX_WEBHOOK_ID')) {
    define('BOOSTBOT_PAYPAL_SANDBOX_WEBHOOK_ID', 'WEBHOOK-ID-HERE');
}

// Live Webhook ID
if (!defined('BOOSTBOT_PAYPAL_LIVE_WEBHOOK_ID')) {
    define('BOOSTBOT_PAYPAL_LIVE_WEBHOOK_ID', 'WEBHOOK-ID-HERE');
}

// Active Webhook ID based on mode
if (!defined('BOOSTBOT_PAYPAL_WEBHOOK_ID')) {
    define('BOOSTBOT_PAYPAL_WEBHOOK_ID', 
        BOOSTBOT_PAYPAL_MODE === 'sandbox' 
            ? BOOSTBOT_PAYPAL_SANDBOX_WEBHOOK_ID 
            : BOOSTBOT_PAYPAL_LIVE_WEBHOOK_ID
    );
}

/**
 * PayPal Business Email
 * 
 * The email associated with the PayPal Business account.
 */
if (!defined('BOOSTBOT_PAYPAL_BUSINESS_EMAIL')) {
    define('BOOSTBOT_PAYPAL_BUSINESS_EMAIL', 'office@boost-media.co.il');
}

/**
 * Legacy Pricing Constants (fallback values only)
 * 
 * ⚠️ NOTE: Pricing is now dynamically controlled by the backend service.
 * These constants serve only as fallback defaults in class-license-manager.php.
 * See boostbot/_archive/paypal-legacy/ for historical context.
 */
if (!defined('BOOSTBOT_PRICE_BASE_PRO')) {
    define('BOOSTBOT_PRICE_BASE_PRO', 20); // Fallback only — actual pricing from backend
}

if (!defined('BOOSTBOT_ADDON_PRICE_BUNDLES')) {
    define('BOOSTBOT_ADDON_PRICE_BUNDLES', 20); // Fallback only — actual pricing from backend
}

