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


try {
    $db=Database::connect();
    $user=(new PlayerAuthService($db))->authenticate([]);
    json_out(['ok'=>true,'accounts'=>(new WithdrawalAccountService($db))->list((int)$user['user_id'])]);
} catch(Throwable $e) {
    json_out(['ok'=>false,'error'=>$e->getMessage()],401);
}
