<?php
/**
 * Plugin activation logic.
 *
 * @package PrimeLink
 */

namespace PrimeLink\Core;

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

final class Activator {

    public static function activate() {
        $upload_dir = wp_upload_dir();
        $base = trailingslashit( $upload_dir['basedir'] ) . 'primelink/';
        if ( ! file_exists( $base ) ) {
            wp_mkdir_p( $base );
        }

        // Set flag to show activation wizard
        update_option( 'mt_primelink_show_activation_wizard', true, false );
        
        // Set activation timestamp
        update_option( 'mt_primelink_activation_time', current_time( 'mysql' ), false );

        // Flush rewrite rules to ensure REST API routes are registered
        flush_rewrite_rules();

        do_action( 'mt_primelink_activate' );
    }

}