<?php

declare(strict_types=1);

use function Pest\Laravel\getJson;

test('confirm api route monitoring exists', function (): void {
    $response = getJson('/api/tricks/monitoring');

    $response->assertSuccessful();

    $response->assertJsonStructure([
        'php',
        'opcacheDisabled',
        'packages' => [
            '*' => [
                'name',
                'version',
            ],
        ],
        'outdatedPackages',
        'hasSentry',
        'hasRobotsMiddleware',
        'hasResponseCache',
        'endpoints' => [
            '*' => [
                'url',
            ],
        ],
        'debugModeDisabled',
        'hasMailConfig',
        'mailUsesCampaignMonitor',
    ]);

    $response->assertJson([
        'php' => PHP_VERSION,
        'opcacheDisabled' => ! function_exists('opcache_get_status') || opcache_get_status() === false,
        'endpoints' => [
            ['url' => 'test1'],
            ['url' => 'test2'],
        ],
    ]);
});
