<?php
/**
 * Plugin Activation Handler
 *
 * @package Licenzo\Hooks\Handler\Plugin
 */

namespace Licenzo\Hooks\Handler\Plugin;

use Licenzo\Framework\Database\Migration\Migrator;
use Licenzo\Hooks\Handler\BaseHandler;
use Licenzo\Modules\WooCommerce\Account;

// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}

/**
 * Handles plugin activation tasks
 */
class ActivationHandler extends BaseHandler
{
    /**
     * Handle plugin activation
     */
    public function handle(...$args)
    {
        try {
            Migrator::migrate($this->app->basePath('database/migrations'));
            Account::flushRewriteRules();
        } catch (\Exception $e) {
            // Will be logged by global exception handler
            return;
        }
    }

}
