import { getMasterDashboardUrl } from "hse-auth";

export const SAT_PORTAL_URL =
  import.meta.env.VITE_SAT_PORTAL_URL || "http://localhost:3000";

/** Standalone HSE Master Dashboard (project launcher). */
export function openMasterDashboard() {
  window.location.assign(getMasterDashboardUrl());
}

/**
 * Open a route on the SAT portal (not the Master Dashboard).
 * @param {string} path e.g. `/dashboard` or `/personalized-dashboard`
 */
export function openSatPortal(path = "/") {
  const base = String(SAT_PORTAL_URL).replace(/\/+$/, "");
  const pathNorm = path.startsWith("/") ? path : `/${path}`;
  window.location.assign(`${base}${pathNorm}`);
}

export { getMasterDashboardUrl };
