import { toast } from "sonner";
import { platform, DESKTOP_DOWNLOAD_URL } from "@/lib/platform";

/**
 * Gate desktop-only features (huddle, screen recording). On Electron this
 * always returns true. On web it shows a toast linking to the desktop app
 * download and returns false — callers should bail.
 */
export function requireDesktop(feature: string): boolean {
  if (platform.kind === "electron") return true;
  toast.message(`${feature} is only available in the desktop app`, {
    action: {
      label: "Download",
      onClick: () => window.open(DESKTOP_DOWNLOAD_URL, "_blank", "noopener,noreferrer"),
    },
  });
  return false;
}
