<?php

declare(strict_types=1);

use App\Models\User;
use App\Models\Workspace;
use App\Models\WorkspaceMembership;
use App\Support\Workspaces\WorkspaceContext;

it('renders intentional empty states when the workspace has no accessible tenant data', function (): void {
    $user = User::factory()->create();
    $workspace = Workspace::factory()->create(['name' => 'Low Data Workspace']);

    WorkspaceMembership::factory()->create([
        'workspace_id' => (int) $workspace->getKey(),
        'user_id' => (int) $user->getKey(),
        'role' => 'readonly',
    ]);

    $this->actingAs($user)
        ->withSession([WorkspaceContext::SESSION_KEY => (int) $workspace->getKey()])
        ->get('/admin')
        ->assertOk()
        ->assertSee('No accessible tenants in this workspace')
        ->assertSee('Nothing urgent in your current scope')
        ->assertSee('No recent operations yet')
        ->assertSee('Switch workspace')
        ->assertDontSee('Choose tenant');
});
