"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { Info } from "lucide-react";
import { Input } from "../../ui/input.js";
import { Label } from "../../ui/label.js";
import { RadioGroup, RadioGroupItem } from "../../ui/radio-group.js";
import { Switch } from "../../ui/switch.js";
import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger
} from "../../ui/tooltip.js";
import { useTranslations } from "next-intl";
import { sel } from "../../../lib/test/index.js";
import { TeamSelector } from "./TeamSelector.js";
function AuthSelector({
  authType,
  apiKey,
  bypassMode,
  selectedTeamId,
  onAuthTypeChange,
  onApiKeyChange,
  onBypassModeChange,
  onTeamChange
}) {
  const t = useTranslations("devtools.apiTester.auth");
  return /* @__PURE__ */ jsxs("div", { className: "space-y-3", "data-cy": sel("devtools.apiExplorer.auth.container"), children: [
    /* @__PURE__ */ jsxs(
      RadioGroup,
      {
        value: authType,
        onValueChange: (value) => onAuthTypeChange(value),
        className: "flex gap-4",
        "data-cy": sel("devtools.apiExplorer.auth.typeGroup"),
        children: [
          /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
            /* @__PURE__ */ jsx(RadioGroupItem, { value: "session", id: "auth-session", "data-cy": sel("devtools.apiExplorer.auth.sessionOption") }),
            /* @__PURE__ */ jsx(Label, { htmlFor: "auth-session", className: "cursor-pointer", children: t("useSession") })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
            /* @__PURE__ */ jsx(RadioGroupItem, { value: "apiKey", id: "auth-apikey", "data-cy": sel("devtools.apiExplorer.auth.apiKeyOption") }),
            /* @__PURE__ */ jsx(Label, { htmlFor: "auth-apikey", className: "cursor-pointer", children: t("useApiKey") })
          ] })
        ]
      }
    ),
    authType === "apiKey" && /* @__PURE__ */ jsx(
      Input,
      {
        placeholder: t("apiKeyPlaceholder"),
        value: apiKey,
        onChange: (e) => onApiKeyChange(e.target.value),
        className: "font-mono",
        type: "password",
        "data-cy": sel("devtools.apiExplorer.auth.apiKeyInput")
      }
    ),
    /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pt-2 border-t", children: [
      /* @__PURE__ */ jsx(
        Switch,
        {
          id: "bypass-mode",
          checked: bypassMode,
          onCheckedChange: onBypassModeChange,
          "data-cy": sel("devtools.apiExplorer.auth.bypassToggle")
        }
      ),
      /* @__PURE__ */ jsx(Label, { htmlFor: "bypass-mode", className: "text-sm cursor-pointer", children: t("adminBypass") }),
      /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
        /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Info, { className: "h-4 w-4 text-muted-foreground cursor-help" }) }),
        /* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: t("adminBypassTooltip") })
      ] }) })
    ] }),
    /* @__PURE__ */ jsx(
      TeamSelector,
      {
        selectedTeamId,
        onTeamChange,
        bypassMode
      }
    )
  ] });
}
export {
  AuthSelector
};
