<?php

declare(strict_types=1);

namespace App\Tests\Mcp\Tool;

use App\Tests\AbstractApiTestCase;

/**
 * @internal
 */
class DashboardStatsToolTest extends AbstractApiTestCase
{
    public function testGetDashboardStatsReturnsCounters(): void
    {
        $site = $this->createSite();
        $this->createMachine(name: 'Machine Stats 1', site: $site);
        $this->createMachine(name: 'Machine Stats 2', site: $site);

        $session = $this->createMcpClient('ROLE_VIEWER');
        $data    = $this->callMcpTool($session, 'get_dashboard_stats');

        $this->assertArrayHasKey('_parsed', $data);
        $stats = $data['_parsed'];
        $this->assertGreaterThanOrEqual(2, $stats['machines']);
        $this->assertArrayHasKey('sites', $stats);
        $this->assertArrayHasKey('unresolvedComments', $stats);
    }
}
