2025-10-18 13:51:40 -06:00

104 lines
3.1 KiB
PHP

<?php namespace App\Http\Controllers\Repuve;
/**
* @copyright (c) 2025 Notsoweb Software (https://notsoweb.com) - All Rights Reserved
*/
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Notsoweb\ApiResponse\Enums\ApiResponse;
class RepuveController extends Controller
{
/**
* Obtener información de vehículo (datos hardcodeados)
*/
public function information()
{
$data = [
"ANIO_PLACA" => "2020",
"PLACA" => "WNU700B",
"NO_SERIE" => "LSGHD52H0ND032457",
"RFC" => "GME111116GJA",
"FOLIO" => "3962243",
"VIGENCIA" => "2025",
"FECHA_IMPRESION" => "10-01-2025",
"QR_HASH" => "Vu5TF4kYsbbltzjDdGQyenKfZoIk2wro34a5Gkh9JVh0CFxfPlrd92YEWK21JF.nLjQNyzKmqRvWYuPiS.kU7A--",
"VALIDO" => true,
"FOLIOTEMP" => false,
"NOMBRE" => "GOLSYSTEMS DE MEXICO S DE RL DE CV",
"NOMBRE2" => "GOLS*MS DXICOE RL*CV",
"MUNICIPIO" => "CENTRO",
"LOCALIDAD" => "VILLAHERMOSA",
"CALLE" => "C BUGAMBILIAS 118 ",
"CALLE2" => "C BU*ILIA*18 ",
"TIPO" => "SEDAN",
"TIPO_SERVICIO" => "PARTICULAR",
"MARCA" => "CHEVROLET G.M.C.",
"LINEA" => "AVEO",
"SUBLINEA" => "PAQ. \"A\" LS",
"MODELO" => 2022,
"NUMERO_SERIE" => "LSGHD52H0ND032457",
"NUMERO_MOTOR" => "H. EN WUHANLL,SGM",
"DESCRIPCION_ORIGEN" => "IMPORTADO",
"COLOR" => "BLANCO",
"CODIGO_POSTAL" => "86179",
"SERIE_FOLIO" => "D3962243",
"SFOLIO" => "3962243"
];
return ApiResponse::OK->response($data);
}
public function store(Request $request)
{
$data = $request->all();
$data['id'] = rand(01, 1000);
$data['created_at'] = now()->toDateTimeString();
return ApiResponse::CREATED->response([
'message' => 'Información almacenada correctamente', 'Registro' => $data
]);
}
public function update(Request $request, $id)
{
$data = $this->information();
$updata['id'] = $id;
$updata['updated_at'] = now()->toDateTimeString();
return ApiResponse::OK->response([
'message' => 'Información actualizada correctamente',
'data' => $updata
]);
}
public function delete($id)
{
return ApiResponse::OK->response();
}
public function stolen(Request $request)
{
$vehicleId = $request->input('epc');
if (!$vehicleId) {
return ApiResponse::BAD_REQUEST->response([
'message' => 'El parámetro epc es requerido'
]);
}
$isStolen = (bool) rand(0, 1);
$response = [
'stolen' => $isStolen,
'message' => $isStolen
? 'El vehículo reporta robo'
: 'El vehículo no reporta robo',
'date' => now()->toDateTimeString()
];
return ApiResponse::OK->response($response);
}
}