import type { Restaurant } from "@/types";

export function buildNavUrl(restaurant: Restaurant): string {
  if (restaurant.location) {
    const parts = restaurant.location.split(",");
    if (parts.length === 2 && parts[0] && parts[1]) {
      return `https://uri.amap.com/marker?position=${parts[0]},${parts[1]}&name=${encodeURIComponent(restaurant.name)}&callnative=1`;
    }
  }
  return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(restaurant.name)}`;
}
