export default defineNuxtRouteMiddleware(async (to, from) => {
  const config = useRuntimeConfig();
  const isComingSoonMode =
    config.public.comingSoon === "true" || config.public.comingSoon === true;

  // Only enforce coming soon mode if enabled
  if (!isComingSoonMode) {
    return;
  }

  // Allow access to the coming-soon page, OIDC login, and admin routes
  if (
    to.path === "/coming-soon" ||
    to.path === "/auth/wiki-login" ||
    to.path.startsWith("/admin")
  ) {
    return;
  }

  // Redirect all other routes to coming-soon
  return navigateTo("/coming-soon");
});
