<?php

declare(strict_types=1);

use App\Models\OperationRun;
use App\Support\OperationRunStatus;
use App\Support\Workspaces\WorkspaceContext;

it('shows workspace identity, summary cards, recent operations, and quick actions', function (): void {
    [$user, $tenant] = createUserWithTenant(role: 'owner');

    OperationRun::factory()->create([
        'tenant_id' => (int) $tenant->getKey(),
        'workspace_id' => (int) $tenant->workspace_id,
        'type' => 'inventory_sync',
        'status' => OperationRunStatus::Running->value,
        'outcome' => 'pending',
    ]);

    $this->actingAs($user)
        ->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
        ->get('/admin')
        ->assertOk()
        ->assertSee('Workspace overview')
        ->assertSee('Accessible tenants')
        ->assertSee('Active operations')
        ->assertSee('Needs attention')
        ->assertSee('Recent operations')
        ->assertSee('Choose tenant')
        ->assertSee('Open operations')
        ->assertSee('Open alerts')
        ->assertSee('Inventory sync');
});
