<?php
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals
defined( 'ABSPATH' ) || exit;

if ( ! function_exists( 'naseo_fs' ) ) {

    function naseo_fs() {
        global $naseo_fs;

        if ( ! isset( $naseo_fs ) ) {
            require_once NASEO_PLUGIN_DIR . 'vendor/freemius/start.php';

            $naseo_fs = fs_dynamic_init( array(
                'id'                  => '31117',
                'slug'                => 'nemynai-seo-autopilot',
                'type'                => 'plugin',
                'public_key'          => 'pk_cdacdb5daaa069140cf6fad8d8a3a',
                'is_premium'          => false,
                'premium_suffix'      => 'Pro',
                'has_premium_version' => true,
                'has_addons'          => false,
                'has_paid_plans'      => true,
                'is_org_compliant'    => true,
                'menu'                => array(
                    'slug'    => 'naseo-dashboard',
                    'support' => false,
                ),
            ) );
        }

        return $naseo_fs;
    }

    naseo_fs();
    do_action( 'naseo_fs_loaded' );
}

/**
 * Перевірка Pro через Freemius
 */
function naseo_is_pro(): bool {
    if ( function_exists( 'naseo_fs' ) ) {
        return naseo_fs()->is_paying();
    }
    return get_option( 'naseo_license_status' ) === 'active';
}
