export type TraceNavigateParams = {
  stockInLineId?: number;
  lotNo?: string;
  itemCode?: string;
};

export const buildItemTracingHref = (params: TraceNavigateParams): string => {
  const q = new URLSearchParams();
  if (params.stockInLineId != null) q.set("stockInLineId", String(params.stockInLineId));
  if (params.lotNo?.trim()) q.set("lotNo", params.lotNo.trim());
  if (params.itemCode?.trim()) q.set("itemCode", params.itemCode.trim());
  const qs = q.toString();
  return qs ? `/itemTracing?${qs}` : "/itemTracing";
};
