<?php

/**
 * Freemius
 */
namespace HulkPlugins\Woo\AccountPages;

defined( 'ABSPATH' ) || exit;
if ( !function_exists( 'HulkPlugins\\Woo\\AccountPages\\hulk_woo_ap_fs' ) ) {
    // Create a helper function for easy SDK access.
    function hulk_woo_ap_fs() {
        global $hulk_woo_ap_fs;
        if ( !isset( $hulk_woo_ap_fs ) ) {
            // Include Freemius SDK.
            // SDK is autoloaded through Composer
            $hulk_woo_ap_fs = fs_dynamic_init( array(
                'id'               => '28412',
                'slug'             => 'hulk-account-pages-for-woocommerce',
                'type'             => 'plugin',
                'public_key'       => 'pk_6dbf19f5e4ce453b05e1b4aa01005',
                'is_premium'       => false,
                'premium_suffix'   => 'Pro',
                'has_addons'       => false,
                'has_paid_plans'   => true,
                'is_org_compliant' => true,
                'trial'            => array(
                    'days'               => 7,
                    'is_require_payment' => false,
                ),
                'menu'             => array(
                    'slug'       => 'edit.php?post_type=hulk_woo_ap_page',
                    'first-path' => 'edit.php?post_type=hulk_woo_ap_page',
                    'contact'    => true,
                    'support'    => true,
                    'account'    => true,
                    'pricing'    => true,
                ),
                'is_live'          => true,
            ) );
        }
        return $hulk_woo_ap_fs;
    }

    // Init Freemius.
    hulk_woo_ap_fs();
    // Signal that SDK was initiated.
    do_action( 'hulk_woo_ap_fs_loaded' );
    function hulk_woo_ap_fs_notice() : string {
        if ( !hulk_woo_ap_fs()->is_premium() ) {
            // Adds a direct checkout link in the free version.
            return sprintf(
                /** @lang text */
                '%s - <a href="%s" target="_blank">%s</a>',
                esc_attr__( 'To use', 'hulk-account-pages-for-woocommerce' ),
                hulk_woo_ap_fs()->checkout_url(),
                esc_attr__( 'UNLOCK PRO', 'hulk-account-pages-for-woocommerce' )
            );
        }
        if ( hulk_woo_ap_fs()->is_not_paying() ) {
            // Adds a upgrade link
            return sprintf(
                /** @lang text */
                '%s - <a href="%s" target="_blank">%s</a>',
                esc_attr__( 'To use', 'hulk-account-pages-for-woocommerce' ),
                hulk_woo_ap_fs()->get_upgrade_url(),
                esc_attr__( 'UPGRADE NOW!', 'hulk-account-pages-for-woocommerce' )
            );
        }
        return '';
    }

}