<?php
require __DIR__ . '/../includes/db.php';

// Fix the ENUM to allow all needed roles
$pdo->exec("ALTER TABLE admin_users MODIFY COLUMN role ENUM('president', 'dm', 'super_admin', 'district_admin', 'ulb_admin') NOT NULL");

// Create or update the super_admin
$hash = password_hash('admin123', PASSWORD_DEFAULT);
$st = $pdo->prepare("INSERT INTO admin_users (username, password_hash, role, is_active) VALUES ('admin', ?, 'super_admin', 1) ON DUPLICATE KEY UPDATE password_hash = ?");
$st->execute([$hash, $hash]);

echo "Success";
