<?php 
require_once(__DIR__."/../config.php"); 
require_once(__DIR__."/../vendor/autoload.php");
//require_once(__DIR__."/../vendor/sql.class.php");

$cs = new cs;  
//$db = new Sql();    

if(strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {       

    $return = [];
    
    if (isset($_POST) && !empty($_POST)) {
        
        if (isset($_POST['ids']) && !empty($_POST['ids'])) {  
            //($_POST['ids']); exit;
            foreach ($_POST['ids'] as $id) {

                $return = $cs->executeQuery("CALL sp_users_delete ('". (int) $id ."')");          

            }
            
        } 

        if (isset($_POST['id']) && !empty($_POST['id'])) {

            $return = $cs->executeQuery("CALL sp_users_delete ('". (int) $_POST['id'] ."')");
                
        } 

        echo json_encode($return);
        // echo json_encode([ 
        //     'success' => (isset($return[0])) ? true : false, 
        //     'class'   => (isset($return[0])) ? 'alert-success' : 'alert-danger' , 
        //     'text'    => 'Usuário cadastrado com sucesso!.',
        //     'data'    => $return
        // ]);     
    }         
}   

?>    