/* FORGE — pump screens registry. Each act registers its routes here.
   Format: { path: "/build/routing", mode: "build", title: "Routing canvas", renderer: () => <Component /> }
   Wave-2 agents push to PUMP_ROUTES from their act registries. */

const PUMP_ROUTES = [];

function registerPumpRoute(route) {
  // De-dupe by path so reloading a single act registry doesn't double-register
  const ix = PUMP_ROUTES.findIndex(function(r) { return r.path === route.path; });
  if (ix >= 0) {
    PUMP_ROUTES[ix] = route;
  } else {
    PUMP_ROUTES.push(route);
  }
  return route;
}

function listPumpRoutes() {
  return PUMP_ROUTES.slice();
}

if (typeof window !== "undefined") {
  window.PUMP_ROUTES        = PUMP_ROUTES;
  window.registerPumpRoute  = registerPumpRoute;
  window.listPumpRoutes     = listPumpRoutes;
}
