export type PagedResponse<T> = {
  items: T[];
  hasMore: boolean;
};

/**
 * Small helper to merge pages without duplicating by key.
 */
export function mergeUniqueByKey<T>(prev: T[], next: T[], getKey: (it: T) => string): T[] {
  const seen = new Set(prev.map(getKey));
  const out = prev.slice();
  for (const it of next) {
    const k = getKey(it);
    if (seen.has(k)) continue;
    seen.add(k);
    out.push(it);
  }
  return out;
}
