<?php
/**
 * License tab — upgrade landing for the free plugin.
 *
 * Brainwerk Security Suite Pro is distributed as a separate plugin via Freemius. License
 * activation, validation, and updates happen inside that Pro plugin once it
 * is installed — this tab only shows where to get it.
 *
 * @package Brainwerk Security Suite
 */

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

$is_pro     = function_exists( 'shieldforge_is_pro' ) ? (bool) shieldforge_is_pro() : false;
$override   = defined( 'SHIELDFORGE_FORCE_PRO' ) && SHIELDFORGE_FORCE_PRO;
$pricing_url = 'https://security-suite.brainwerk.at/pricing/';
$account_url = 'https://security-suite.brainwerk.at/account/';
$docs_url    = 'https://security-suite.brainwerk.at/docs/';
?>
<div class="shieldforge-card">
    <h2>
        <?php esc_html_e( 'License', 'brainwerk-security-suite' ); ?>
        <?php if ( $is_pro ) : ?>
            <span class="sf-badge sf-badge-pro"><?php esc_html_e( 'Pro', 'brainwerk-security-suite' ); ?></span>
        <?php else : ?>
            <span class="sf-badge"><?php esc_html_e( 'Free', 'brainwerk-security-suite' ); ?></span>
        <?php endif; ?>
    </h2>

    <?php if ( $override ) : ?>
        <p class="muted">
            <strong><?php esc_html_e( 'SHIELDFORGE_FORCE_PRO override is active.', 'brainwerk-security-suite' ); ?></strong>
            <?php esc_html_e( 'Pro features are unlocked locally without a license check. Remove the constant from wp-config.php to switch back to the standard licensing flow.', 'brainwerk-security-suite' ); ?>
        </p>
    <?php elseif ( $is_pro ) : ?>
        <p>
            <?php esc_html_e( 'Brainwerk Security Suite Pro is active on this site.', 'brainwerk-security-suite' ); ?>
            <?php
            printf(
                ' ' . esc_html__( 'Manage your subscription and download future updates at %s.', 'brainwerk-security-suite' ),
                '<a href="' . esc_url( $account_url ) . '" target="_blank" rel="noopener">security-suite.brainwerk.at/account</a>'
            );
            ?>
        </p>
    <?php else : ?>
        <p>
            <?php esc_html_e( 'Brainwerk Security Suite is fully functional on the free tier. Upgrade to Pro to unlock 2FA-Passkeys, Geo-Blocking, Cloud Threat Intel, multisite aggregate dashboards, AI-assisted incident analysis (BYOK or self-hosted), Slack/Discord/Telegram/Teams notifications, and white-label mode.', 'brainwerk-security-suite' ); ?>
        </p>
        <p>
            <a href="<?php echo esc_url( $pricing_url ); ?>" class="button button-primary" target="_blank" rel="noopener">
                <?php esc_html_e( 'View Pro plans →', 'brainwerk-security-suite' ); ?>
            </a>
            <a href="<?php echo esc_url( $docs_url ); ?>" class="button" target="_blank" rel="noopener" style="margin-left:8px">
                <?php esc_html_e( 'Documentation', 'brainwerk-security-suite' ); ?>
            </a>
        </p>
        <p class="muted">
            <?php esc_html_e( 'After purchase you will receive the Brainwerk Security Suite Pro plugin (.zip) plus a license key. Install the Pro plugin alongside this free one — activation happens inside the Pro plugin.', 'brainwerk-security-suite' ); ?>
        </p>
    <?php endif; ?>
</div>

<div class="shieldforge-card">
    <h2><?php esc_html_e( 'Pro features', 'brainwerk-security-suite' ); ?></h2>
    <ul class="sf-feature-list">
        <li><strong><?php esc_html_e( 'WebAuthn / Passkeys', 'brainwerk-security-suite' ); ?></strong> — <?php esc_html_e( 'phishing-resistant login with hardware keys, Face ID, Touch ID, Windows Hello.', 'brainwerk-security-suite' ); ?></li>
        <li><strong><?php esc_html_e( 'Geo-IP blocking', 'brainwerk-security-suite' ); ?></strong> — <?php esc_html_e( 'country allow/deny lists on login, register, comment, REST.', 'brainwerk-security-suite' ); ?></li>
        <li><strong><?php esc_html_e( 'Cloud Threat Intel', 'brainwerk-security-suite' ); ?></strong> — <?php esc_html_e( 'Spamhaus DROP synced daily, EU-hosted relay.', 'brainwerk-security-suite' ); ?></li>
        <li><strong><?php esc_html_e( 'AI Backend (BYOK or self-hosted)', 'brainwerk-security-suite' ); ?></strong> — <?php esc_html_e( 'Mistral (EU) or local Ollama analyse flagged security events on demand. No data leaves your stack unless you opt in.', 'brainwerk-security-suite' ); ?></li>
        <li><strong><?php esc_html_e( 'Slack / Discord / Telegram / Teams', 'brainwerk-security-suite' ); ?></strong> — <?php esc_html_e( 'real-time channel notifications for incidents and digest reports.', 'brainwerk-security-suite' ); ?></li>
        <li><strong><?php esc_html_e( 'Multisite aggregate dashboard', 'brainwerk-security-suite' ); ?></strong> — <?php esc_html_e( 'cross-site attacker view, per-site threat scores, network-wide 2FA coverage.', 'brainwerk-security-suite' ); ?></li>
        <li><strong><?php esc_html_e( 'White-label mode', 'brainwerk-security-suite' ); ?></strong> — <?php esc_html_e( 'rebrand the plugin in admin for client installs.', 'brainwerk-security-suite' ); ?></li>
    </ul>
</div>
