/**
 * Shared query utilities used by pages and hooks.
 */

import type { HistoryQuery } from "../types/history";

/**
 * Compare two history query objects for semantic equality.
 *
 * @param a - First query object.
 * @param b - Second query object.
 * @returns True when every query field has the same value.
 */
export function areHistoryQueriesEqual(
  a: HistoryQuery,
  b: HistoryQuery,
): boolean {
  return (
    a.range === b.range &&
    a.origin === b.origin &&
    a.jail === b.jail &&
    a.ip === b.ip &&
    a.source === b.source &&
    a.page === b.page &&
    a.page_size === b.page_size
  );
}
