<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

$app->get('/accion11711898', function (Request $pedido, Response $res, $post) {
$a=new Consulta(); $a1=$a->encriptar("123");  $b=new Consulta(); $b1=$b->desencriptar($a1);echo $b1; echo "\n"; $res->getBody()->write($a1);return $res;});

$app->post('/sesion',function (Request $pedido, Response $res, $args) {
$post=$pedido->getParsedBody(); $a=new Consulta(); $a1=$a->inicio_sesion($post["correo"],$post["pass"],$post["perfil"],$post["idEmpresa"]??"1");
$res->getBody()->write($a1); return $res->withHeader('Content-Type', 'application/json');});

$app->post('/obtenerToken',function (Request $pedido, Response $res, $args) {
$post=$pedido->getParsedBody(); $a=new Consulta(); $a1=$a->obtener_token($post["token"]);  
$res->getBody()->write($a1); return $res->withHeader('Content-Type', 'application/json');});

$app->post('/ingresoToken',function (Request $pedido, Response $res, $args) {
$post=$pedido->getParsedBody(); $a=new Consulta(); $a1=$a->ingreso_token($post["idCliente"]);
$res->getBody()->write($a1); return $res->withHeader('Content-Type', 'application/json');});

$app->post('/buscadorGeneralCliente',function (Request $pedido, Response $res, $args) {
$post=$pedido->getParsedBody(); $a=new Consulta(); $a1=$a->buscadorGeneralCliente($post["busqueda"],$post["idCliente"],$post["acceso"],$post["marca"],$post["idVendedor"]??"0",$post["idBodega"]??"6",$post["idEmpresa"]??"1");
$res->getBody()->write($a1); return $res->withHeader('Content-Type', 'application/json');});
?>
