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


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