// src/lib/sites/active-site-client.ts — cookie name + client-side writer (no server-only,
// so both the RSC helper and the client SiteProvider can share the name).
export const ACTIVE_SITE_COOKIE = "active-site-id";

/** Persist the active site id in a cookie the server can read. No-op on the server. */
export function writeActiveSiteCookie(id: string): void {
  if (typeof document === "undefined") return;
  // biome-ignore lint/suspicious/noDocumentCookie: server-readable cookie, CookieStore not supported everywhere
  document.cookie = `${ACTIVE_SITE_COOKIE}=${encodeURIComponent(id)}; path=/; max-age=31536000; samesite=lax`;
}
