<?php

use Illuminate\Support\Facades\Route;

Route::get('/test-permissions', function () {
    $user = auth()->user();
    
    if (!$user) {
        return response()->json(['error' => 'Not authenticated']);
    }
    
    return response()->json([
        'user' => [
            'name' => $user->name,
            'email' => $user->email,
        ],
        'roles' => $user->roles->pluck('name'),
        'permissions' => $user->getAllPermissions()->pluck('name'),
        'has_users_view' => $user->hasPermission('users.view'),
        'has_users_manage' => $user->hasPermission('users.manage'),
        'is_super_admin' => $user->hasRole('super_admin'),
    ]);
})->middleware('auth');
