<?php

namespace Tests\Feature;

use App\Models\User;
use App\Models\Website;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class PanelPagesTest extends TestCase
{
    use RefreshDatabase;

    public function test_super_admin_can_open_main_panel_pages(): void
    {
        $user = User::factory()->superAdmin()->create();
        $website = Website::factory()->for($user, 'createdBy')->create();
        $website->agent()->create([
            'status' => 'online',
            'authentication_status' => 'verified',
            'sync_status' => 'synced',
            'capabilities' => ['health', 'tables', 'backups'],
        ]);

        $paths = [
            route('dashboard'),
            route('websites.index'),
            route('websites.show', $website),
            route('database-manager.index'),
            route('backups.index'),
            route('activity-logs.index'),
            route('agents.index'),
            route('system-health.index'),
            route('settings.index'),
            route('profile.show'),
            route('search', ['q' => $website->name]),
        ];

        foreach ($paths as $path) {
            $this->actingAs($user)->get($path)->assertOk();
        }
    }
}
