<?php
/**
 * بهینه‌سازی کنترل پروژه — ایندکس‌ها و schema
 * php run-pc-optimize.php
 */
declare(strict_types=1);

if ( ! defined( 'ACC_BASE_PATH' ) ) {
    define( 'ACC_BASE_PATH', __DIR__ );
    require __DIR__ . '/standalone/bootstrap.php';
}

header( 'Content-Type: application/json; charset=utf-8' );

require_once ACC_PATH . 'includes/helpers/pc-service.php';

$indexes = PC_Service::ensure_performance_indexes();

echo wp_json_encode( [
    'success'        => true,
    'module'         => 'project_control',
    'indexes_added'  => $indexes,
    'features'       => [
        'list_projects_aggregate' => true,
        'workspace_api'           => '/pc/projects/{id}/workspace',
        'cpm_batch_update'        => true,
        'frontend_single_fetch'   => true,
    ],
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT );
