<?php

declare(strict_types=1);

use App\Models\PlatformUser;
use App\Models\ManagedEnvironment;

it('returns 404 for platform-guard sessions on admin workspace-scoped routes', function (): void {
    $tenant = ManagedEnvironment::factory()->create();
    $workspace = $tenant->workspace;

    expect($workspace)->not->toBeNull();

    $platformUser = PlatformUser::factory()->create();

    $workspaceRouteKey = (string) ($workspace->slug ?? $workspace->getKey());

    $this->actingAs($platformUser, 'platform')
        ->get("/admin/w/{$workspaceRouteKey}/ping")
        ->assertNotFound();
});

it('returns 404 for platform-guard sessions on the workspace overview home', function (): void {
    $platformUser = PlatformUser::factory()->create();

    $this->actingAs($platformUser, 'platform')
        ->get('/admin')
        ->assertNotFound();
});
