<?php
require __DIR__.'/_bootstrap.php';

use Zoo\Database;
use Zoo\Auth\PlayerAuthService;

try{
    $db=Database::connect();
    (new PlayerAuthService($db))->authenticate([]);

    $rows=$db->query("
      SELECT provider_code,display_name,environment,enabled,integration_mode
      FROM payment_gateway_config
      ORDER BY id
    ")->fetchAll(PDO::FETCH_ASSOC);

    json_out(['ok'=>true,'providers'=>$rows]);
}catch(Throwable $e){
    json_out(['ok'=>false,'error'=>$e->getMessage()],401);
}
