<?php
require_once __DIR__ . '/../includes/functions.php';
requireLogin();

// Accept both POST and GET for easier debugging
// (browser can test GET directly; real use is POST)
try {
    $cardCode = generateCardCode();
    jsonResponse(['success' => true, 'card_code' => $cardCode]);
} catch (Exception $e) {
    jsonResponse(['success' => false, 'error' => 'Card generation failed: ' . $e->getMessage()]);
}
