<?php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');

require '../../modelo/paqueteria.php';
$response = array();

if (
    !isset($_POST['id_paqueteria'])
) {
    $response['response'] = 'error';
    $response['data'] = 'Datos incompletos';
    echo json_encode($response);
    return;
}

$id_paqueteria = $_POST['id_paqueteria'];

$paqueteria = Paqueteria::mdlDeletePaqueteria($id_paqueteria);

if (!$paqueteria) {
    $response['response'] = 'error';
    $response['data'] = 'No se pudo eliminar la paqueteria';
    echo json_encode($response);
    return;
}

$response['response'] = 'success';
$response['data'] = $paqueteria;
echo json_encode($response);