/**
 * Reserved slugs for the /deals/[...path] routing grammar.
 *
 * These strings are structural tokens in the URL path and must never be used
 * as category or tag slugs. Any admin-managed slug that collides with this
 * list would produce an ambiguous or broken route.
 */

export const RESERVED_LITERAL_SLUGS = new Set([
  'all',
  'coupon',
  'group',
  '-',
  'deals',
  'tag',
  'tags',
  'category',
  'categories',
]);

/** Matches page-N segments (e.g. page-1, page-42). */
export const RESERVED_SLUG_PATTERN = /^page-\d+$/;

/**
 * Returns true when a slug string is reserved for routing grammar and must
 * not be assigned to a category or tag.
 */
export function isReservedSlug(slug: string): boolean {
  return RESERVED_LITERAL_SLUGS.has(slug) || RESERVED_SLUG_PATTERN.test(slug);
}
