<?php
declare(strict_types=1);

$config = require __DIR__ . '/app/config.php';
require __DIR__ . '/app/db.php';

$email = $_GET['email'] ?? 'admin@blockspark.pt';
$pass  = $_GET['pass'] ?? '123456';
$name  = $_GET['name'] ?? 'Admin';

$hash = password_hash($pass, PASSWORD_DEFAULT);

$stmt = $pdo->prepare("INSERT INTO users (name,email,password_hash,role,is_active) VALUES (?,?,?,'admin',1)");
$stmt->execute([$name,$email,$hash]);

echo "Admin criado.\nEmail: {$email}\nPassword: {$pass}\n\nAPAGA ESTE FICHEIRO create_admin.php AGORA.\n";
