<?php

namespace App\Helpers;

class Auth
{
    public static function requireRole(array $roles): void
    {
        $user = SessionHelper::user();
        if (!$user || !in_array($user['role'], $roles, true)) {
            header('Location: index.php?route=login');
            exit;
        }
    }

    public static function check(): ?array
    {
        return SessionHelper::user();
    }
}

