<?php
require __DIR__.'/_bootstrap.php';
use Zoo\Database;
use Zoo\Auth\PlayerAuthService;
use Zoo\Deposit\DepositService;

try{
    $db=Database::connect();
    $player=(new PlayerAuthService($db))->authenticate([]);
    $id=(int)($_GET['id']??0);
    json_out(['ok'=>true,'deposit'=>(new DepositService($db))->getForUser((int)$player['user_id'],$id)]);
}catch(Throwable $e){
    json_out(['ok'=>false,'error'=>$e->getMessage()],422);
}
