<?php

use App\Domains\Workspace\Actions\CreateWorkspace;
use App\Models\User;

beforeEach(function () {
    $this->user = User::factory()->create();
    $this->workspace = (new CreateWorkspace)->handle($this->user, ['name' => 'Smoke Test WS']);
});

// ── Profile routes ─────────────────────────────────
test('profile routes return 200', function (string $route) {
    $this->actingAs($this->user)
        ->get(route($route))
        ->assertOk();
})->with([
    'profile.personal',
    'profile.preferences',
    'profile.security',
]);

// ── Workspace routes ────────────────────────────────
test('workspace routes return 200', function (string $routeName) {
    $ws = $this->workspace;
    $this->actingAs($this->user)
        ->get(route($routeName, $ws->ulid))
        ->assertOk();
})->with([
    'w.dashboard',
    'w.links.index',
    'w.qr.index',
    'w.bio.index',
    'w.analytics.index',
    'w.domains.index',
    'w.team.index',
    'w.billing.index',
    'w.settings.index',
    'w.settings.api-tokens',
    'w.settings.webhooks',
]);

// ── AI routes ──────────────────────────────────────
test('AI routes return 200', function (string $routeName) {
    $ws = $this->workspace;
    $this->actingAs($this->user)
        ->get(route($routeName, $ws->ulid))
        ->assertOk();
})->with([
    'w.ai.insights',
    'w.ai.anomalies',
    'w.ai.ab-generator',
]);
