<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
header('Content-Type: application/json; charset=utf-8');
$root = __DIR__;
$required = [
  'config.php',
  'bot.php',
  'app/Legacy/CoreApi.php',
  'app/Legacy/MenuShopOrderHelpers.php',
  'app/Legacy/ChannelHelpers.php',
  'app/Legacy/OrderTrackingHelpers.php',
  'app/Legacy/LeftPenaltyHelpers.php',
  'app/Legacy/AdminTopHelpers.php',
  'app/Runtime/WebhookRuntime.php',
  'app/Runtime/WebhookPart01.php',
  'app/Runtime/WebhookPart02.php',
  'app/Runtime/WebhookPart03.php',
  'app/Runtime/WebhookPart04.php',
  'app/Services/HomeKeyboardService.php',
  'app/Services/SimpleShopService.php',
  'app/Services/RewardService.php',
];
$optional = [
  'config_db.php',
  'lib/db_storage.php',
  'lib/class.php',
  'lib/jdf.php',
  'app/Bootstrap.php',
  'app/Services/ScaleOptimizerService.php',
  'app/Services/JsonCacheService.php',
  'app/Support/TextFormatting.php',
];
$out = ['ok'=>true, 'php'=>PHP_VERSION, 'missing_required'=>[], 'missing_optional'=>[]];
foreach ($required as $f) if (!is_file($root.'/'.$f)) { $out['ok']=false; $out['missing_required'][]=$f; }
foreach ($optional as $f) if (!is_file($root.'/'.$f)) { $out['missing_optional'][]=$f; }
echo json_encode($out, JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);
