<?php
include_once '../config/header.php';
include_once '../config/helper.php';
include_once '../config/database.php';
include_once '../objects/eventos_alerta.php';
include_once '../token/validatetoken.php';

$database = new Database();
$db = $database->getConnection();
$eventos_alerta = new Eventos_Alerta($db);
$data = json_decode(file_get_contents("php://input"));

$eventos_alerta->id = $data->id;

if(!isEmpty($eventos_alerta->id)){
 
if($eventos_alerta->update_patch($data)){
    http_response_code(200);
	echo json_encode(array("status" => "success", "code" => 1,"message"=> "Updated Successfully","document"=> ""));
}
else{
    http_response_code(503);
	echo json_encode(array("status" => "error", "code" => 0,"message"=> "Unable to update eventos_alerta","document"=> ""));
    }
}
else{
    http_response_code(400);
	echo json_encode(array("status" => "error", "code" => 0,"message"=> "Unable to update eventos_alerta. Data is incomplete.","document"=> ""));
}
?>
