<?php
require_once __DIR__.'/_auth.php';if($_SERVER['REQUEST_METHOD']!=='POST')jsonResponse(['ok'=>false,'erro'=>'Método não permitido.'],405);$admin=afAdminApiUser($pdo);$d=requestJson();try{$total=afAdminNotify($pdo,(int)$admin['id'],(string)($d['titulo']??''),(string)($d['mensagem']??''),(string)($d['segmento']??'todos'),isset($d['usuario_id'])?(int)$d['usuario_id']:null);jsonResponse(['ok'=>true,'enviadas'=>$total]);}catch(Throwable $e){jsonResponse(['ok'=>false,'erro'=>$e->getMessage()],422);}
