<?php
require_once __DIR__ . '/../api/bootstrap.php';
$name = $argv[1] ?? 'Administrador';
$email = $argv[2] ?? 'report@cartoriocopacabana.com';
$pass = $argv[3] ?? 'report@2026';
$hash = password_hash($pass, PASSWORD_DEFAULT);
$pdo = Database::pdo();
$pdo->prepare('INSERT INTO users (name,email,password_hash,role,active) VALUES (?,?,?,?,1) ON DUPLICATE KEY UPDATE name=VALUES(name), password_hash=VALUES(password_hash), role=VALUES(role), active=1')
    ->execute([$name,$email,$hash,'admin']);
echo "Admin criado/atualizado: {$email}\nSenha: {$pass}\n";
