<?php
/**
 * Plugin Name: Breakdance AI
 * Plugin URI: https://breakdance.com/ai
 * Description: Power your website with AI.
 * Author: Breakdance
 * Version: 1.2.0
 * Author URI: https://breakdance.com/
 * Requires PHP: 8.0
 */

namespace Breakdance\AI;

define('BREAKDANCE_AI_VERSION', '1.2.0'); // DO NOT EDIT. Autogenerated by build script
define('BREAKDANCE_AI_EDD_ITEM_ID', 72910);

function init() {
    require_once __DIR__ . "/vendor/autoload.php";

    // Functions
    require_once __DIR__ . '/utils.php';
    require_once __DIR__ . '/settings.php';
    require_once __DIR__ . '/endpoints.php';
    require_once __DIR__ . '/completion.php';
    require_once __DIR__ . '/unsplash.php';
    require_once __DIR__ . '/owauid.php';
    require_once __DIR__ . '/license.php';
    require_once __DIR__ . '/rate-limit.php';
}

function display_missing_dependency_notice() {
    ?>
    <div class="notice notice-error">
        <p>
            <b>Breakdance AI:</b> Breakdance must be installed. <a href="https://breakdance.com/" target="_blank">Download Now</a>
        </p>
    </div>
    <?php
}

function display_outdated_dependency_notice() {
    ?>
    <div class="notice notice-error">
        <p>
            <b>Breakdance AI:</b> Breakdance must be updated to version <b>2.0.0</b> or higher.
        </p>
    </div>
    <?php
}

add_action('plugins_loaded', function () {
    if (!defined('__BREAKDANCE_PLUGIN_FILE__') || (defined('BREAKDANCE_MODE') && BREAKDANCE_MODE === 'oxygen')) {
        add_action('admin_notices', '\Breakdance\AI\display_missing_dependency_notice');
    } elseif (!defined('__BREAKDANCE_AI_SUPPORTED__')) {
        add_action('admin_notices', '\Breakdance\AI\display_outdated_dependency_notice');
    } else {
        init();
    }
});
