<?php
declare(strict_types=1);
if ( ! defined( 'ACC_BASE_PATH' ) ) {
    define( 'ACC_BASE_PATH', __DIR__ );
    require __DIR__ . '/standalone/bootstrap.php';
}
require_once ACC_PATH . 'includes/helpers/pc-service.php';

$t0 = microtime(true);
$projects = PC_Service::list_projects( 'WHERE 1=1', [] );
$t1 = microtime(true);
$ws = PC_Service::workspace( 1, 'tasks' );
$t2 = microtime(true);

echo wp_json_encode( [
    'projects_count' => count( $projects ),
    'list_ms'        => round( ( $t1 - $t0 ) * 1000, 2 ),
    'workspace_tasks'=> [
        'wbs'  => count( $ws['wbs'] ?? [] ),
        'tasks'=> count( $ws['tasks'] ?? [] ),
        'deps' => count( $ws['dependencies'] ?? [] ),
        'members' => count( $ws['members'] ?? [] ),
    ],
    'workspace_ms'   => round( ( $t2 - $t1 ) * 1000, 2 ),
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT );
