<?php

declare(strict_types=1);

namespace App\Tests\Api;

use App\Tests\AbstractApiTestCase;

/**
 * @internal
 */
class HealthCheckTest extends AbstractApiTestCase
{
    public function testHealthEndpointPublicReturnsMinimalInfo(): void
    {
        $client = $this->createUnauthenticatedClient();
        $client->request('GET', '/api/health');

        $this->assertResponseIsSuccessful();
        $this->assertJsonContains(['status' => 'ok']);

        $data = $client->getResponse()->toArray();
        $this->assertArrayNotHasKey('php', $data);
        $this->assertArrayNotHasKey('checks', $data);
        $this->assertArrayNotHasKey('memory_mb', $data);
    }

    public function testHealthEndpointAdminReturnsFullInfo(): void
    {
        $client = $this->createAdminClient();
        $client->request('GET', '/api/health');

        $this->assertResponseIsSuccessful();
        $this->assertJsonContains([
            'status' => 'ok',
            'checks' => [
                'database' => [
                    'status' => 'ok',
                ],
            ],
        ]);
    }
}
