<?php

require_once __DIR__ . '/auth.php';

function requireAdmin(): array
{
    $user = requireAuth();

    if (($user['role'] ?? 'user') !== 'admin') {
        jsonResponse(false, 'Forbidden', null, 403);
    }

    return $user;
}
