import type { Order } from "@/lib/api/types";

/** Label for open orders at pay time: table + guest name. */
export function formatPosOrderLabel(
  order: Pick<Order, "tableNumber" | "guestName" | "customerName">,
  tableWord: string
): string {
  const parts: string[] = [];
  if (order.tableNumber) {
    parts.push(`${tableWord} ${order.tableNumber}`);
  }
  const name = order.guestName?.trim() || order.customerName?.trim();
  if (name) {
    parts.push(name);
  }
  return parts.length > 0 ? parts.join(" · ") : "—";
}
