<?php
/**
 * Woocom-Pay Pro — License Key Generator
 *
 * Run from the terminal:
 *   php tools/generate-license-key.php
 *   php tools/generate-license-key.php 10    ← generate 10 keys
 *
 * Keys are self-validating offline (no server needed).
 * Each generated key is unique and cryptographically secure.
 * Store generated keys safely — each one activates one site.
 */

// Load the license class directly (no WordPress needed).
require_once __DIR__ . '/../includes/class-wcp-license.php';

// Stub out the ABSPATH check so the class loads outside WordPress.
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', __DIR__ . '/' );
}

$count = isset( $argv[1] ) && is_numeric( $argv[1] ) ? (int) $argv[1] : 1;
$count = max( 1, min( $count, 500 ) );

echo "\nWoocom-Pay Pro — License Key Generator\n";
echo str_repeat( '─', 42 ) . "\n\n";

for ( $i = 0; $i < $count; $i++ ) {
	echo WCP_License::generate() . "\n";
}

echo "\n" . $count . " key(s) generated. Keep these safe — each key activates one Pro license.\n\n";
