<?php

/**
 * Bootstrap class for the Smart eGift Card plugin.
 *
 * @package SGC\eGiftCard\Config
 */

namespace SGC\eGiftCard\Config;

defined( 'ABSPATH' ) || exit; // Prevent direct file access.

use SGC\eGiftCard\Foundation\Application;
use SGC\eGiftCard\Hooks\Handler\ActivationHandler;

/**
 * Class Bootstrap
 *
 * Bootstraps the Smart eGift Card plugin.
 */
class Bootstrap
{

    /**
     * Bootstraps the plugin.
     *
     * @return void
     */
    public function boot()
    {
        // Include REST API routes.
        add_action( 'rest_api_init', [ $this, 'include_api_routes' ] );

        $app = Application::instance();
        $app->load();
    }

    /**
     * Handles plugin activation.
     *
     * @return void
     */
    public static function activate_me()
    {
        // Handle plugin activation.
        $activation_handler = new ActivationHandler();
        $activation_handler->handle();
    }

    /**
     * Includes REST API routes.
     *
     * @return void
     */
    public function include_api_routes()
    {
        require_once SMART_GIFT_CARD_PLUGIN_BASE_PATH . 'app/Http/Router/Api.php';
    }
}
