// Simple mobile-vs-web client detection based on the User-Agent
// appended by Capacitor config (appendUserAgent: "PedScribe-Android",
// similarly for iOS) and an optional X-Client header.
function isMobileClient(req) {
  if (!req) return false;
  var xc = req.headers && req.headers['x-client'];
  if (xc === 'mobile' || xc === 'ios' || xc === 'android') return true;
  var ua = (req.headers && req.headers['user-agent']) || '';
  return /PedScribe|Capacitor/i.test(ua);
}

module.exports = { isMobileClient: isMobileClient };
