<?php
// api/get-config.php — Devuelve hints de config global (nunca valores completos)
header('Content-Type: application/json');
require_once __DIR__ . '/../auth.php';
require_once __DIR__ . '/../credentials.php';
dm_require_admin();

function hint(string $val): string {
    if (!$val) return '';
    return substr($val, 0, 6) . str_repeat('•', min(12, max(4, strlen($val) - 6)));
}

echo json_encode([
    'ok'                  => true,
    'claude_key_hint'     => hint(dm_claude_api_key()),
    'meta_token_hint'     => hint(defined('META_SYSTEM_TOKEN') ? META_SYSTEM_TOKEN : ''),
    'meta_app_id'         => defined('META_APP_ID') ? META_APP_ID : '',
    'google_dev_token_hint' => hint(defined('GOOGLE_DEV_TOKEN') ? GOOGLE_DEV_TOKEN : ''),
    'google_client_id'    => defined('GOOGLE_CLIENT_ID') ? GOOGLE_CLIENT_ID : '',
    'google_mcc_id'       => defined('GOOGLE_MCC_ID') ? GOOGLE_MCC_ID : '',
]);
