<?php
require_once __DIR__.'/../../_bootstrap.php';$u=apiUsuario($pdo);if($_SERVER['REQUEST_METHOD']!=='POST')jsonResponse(['ok'=>false,'erro'=>'Método não permitido.'],405);$d=requestJson();$ids=is_array($d['document_ids']??null)?$d['document_ids']:[];
try{$count=afRecordLegalAcceptances($pdo,(int)$u['id'],$ids,'api_acceptance',(int)$u['id']);jsonResponse(['ok'=>true,'registered'=>$count,'missing'=>afMissingLegalAcceptances($pdo,(int)$u['id'])]);}catch(Throwable $e){jsonResponse(['ok'=>false,'erro'=>$e->getMessage()],422);}
