<?php
require __DIR__.'/_bootstrap.php';
use Zoo\Database;
use Zoo\Withdrawal\RaastAgentService;
try{
 $db=Database::connect();$svc=new RaastAgentService($db);
 $token=(string)($_SERVER['HTTP_X_RAAST_AGENT_TOKEN']??'');
 $agent=$svc->authenticate($token);
 json_out(['ok'=>true,'agent'=>$agent,'queue'=>$svc->queue((int)$agent['id'])]);
}catch(Throwable $e){json_out(['ok'=>false,'error'=>$e->getMessage()],401);}
