<?php
require_once __DIR__.'/../../_bootstrap.php';
require_once ROOT_PATH.'/includes/match_functions.php';
if($_SERVER['REQUEST_METHOD']!=='POST')jsonResponse(['ok'=>false,'erro'=>'Método não permitido.'],405);
afValidarCsrfApi();$u=afApiOuSessaoUsuario($pdo);$d=requestJson();
try{$r=afEquiparRecompensa($pdo,(int)$u['id'],(int)($d['recompensa_id']??0));jsonResponse(['ok'=>true,'recompensa'=>$r,'equipamentos'=>afEquipamentoUsuario($pdo,(int)$u['id'])]);}
catch(Throwable $e){jsonResponse(['ok'=>false,'erro'=>$e->getMessage()],422);}
