<?php

/*
 * ROMAN DIGITAL - Autor: Américo Patetta
 */

set_include_path("../../");
include_once("server/class/PedidosManager.php");
include_once("server/class/GeoUtils.php");

$jsonParams = file_get_contents('php://input');
$paramObj = json_decode($jsonParams);

if (isset($paramObj->idPedido) && isset($paramObj->idLocal)&& isset($paramObj->token) && ($paramObj->token == TOKEN_WEB || $paramObj->token == TOKEN_BRODEVO)) {
   $status = PedidosManager::getPedidoPosition($paramObj->idPedido,$paramObj->idLocal);
   $response['status'] = ($status)?$status:"N/D";
   $response['error'] = ($status)?0:-1;
} else {
    $response['error'] = -2;
    $response['status'] ="N/D";
}

header('Content-Type: application/json; charset=utf-8');
echo json_encode($response);
