<?php
// register_user.php - Utility to register a user for testing
require_once 'config.php';

$username = $_GET['name'] ?? 'TestUser';

// Insert user into Supabase
$response = supabase_request('POST', 'users', [
    'username' => $username,
    'wallet_balance' => 0.00
]);

if ($response['status'] == 201 || $response['status'] == 200) {
    echo "<h1>User Registered Successfully!</h1>";
    echo "<b>Username:</b> " . $username . "<br>";
    echo "<b>User ID:</b> " . $response['data'][0]['id'] . "<br>";
    echo "<i>Save this ID to use in your payment requests and Web demo.</i>";
} else {
    echo "Error registering user: <br>";
    print_r($response);
}
?>
