export const Paths = {
  home: "/",
  editor: "/editor",
  viewer: "/viewer",
  viewerBySlug: "/catalogue",
  catalog: {
    list: "/catalogue",
    business: "/business/",
  },
  designer: {
    request: "/designer/request",
    list: "/designer/requests/list",
  },
};

const viewerPathPrefix = `${Paths.viewer}/`;
const viewerBySlugPathPrefix = `${Paths.viewerBySlug}/`;

const businessCatalogPathPrefix = Paths.catalog.business;

/** Public business catalogue grid: /business/:slug */
export const isBusinessCatalogPath = (pathname: string): boolean => {
  return pathname.startsWith(businessCatalogPathPrefix) && pathname.length > businessCatalogPathPrefix.length;
};

/** Full-screen viewer: /viewer/:id or /catalogue/:slug (not the list at /catalogue). */
export const isViewerPath = (pathname: string): boolean => {
  const isViewerById = pathname.startsWith(viewerPathPrefix) && pathname.length > viewerPathPrefix.length;
  const isViewerBySlug = pathname.startsWith(viewerBySlugPathPrefix) && pathname.length > viewerBySlugPathPrefix.length;
  return isViewerById || isViewerBySlug;
};

/** Routes that do not require login (must stay in sync with PrivateRoute requireAuth={false}) */
export const isPublicPath = (pathname: string): boolean => {
  return pathname === Paths.home || isViewerPath(pathname);
};
