<?php
require_once __DIR__ . '/../config/db.php';
require_once __DIR__ . '/../config/auth.php';
require_once __DIR__ . '/odo_helper.php';
requireAuth();
$db        = getDB();
$vehicleId = (int)post('vehicle_id', 0);
if (!$vehicleId) apiError('Vehicle ID required.', 422);
$latest = getVehicleLatestOdo($db, $vehicleId);
apiSuccess(['latest_odo' => $latest]);
