<?php
/**
 * نصب جداول ABC اقتصاد ملک
 * C:\xampp\php\php.exe run-melk-abc-install.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/melk-activity-cost.php';
Melk_Activity_Cost::ensure_tables();

$acts = Melk_Activity_Cost::list_activities( false );
echo wp_json_encode( [
    'success' => true,
    'message' => 'جداول ABC ملک آماده شد',
    'activities' => count( $acts ),
    'sample' => array_slice( $acts, 0, 3 ),
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT );
