import { ApiRoute } from "@/utils/type";
import classNames from "classnames";

// const TABS = ["headers", "parameters", "body", "snippet"];
export const Tabs = ({
  active,
  setActive,
  endpoint,
}: {
  active: "headers" | "parameters" | "body" | "snippet";
  setActive: (active: "headers" | "parameters" | "body" | "snippet") => void;
  endpoint: ApiRoute;
}) => {
  return (
    <ul className="flex items-center justify-center gap-6 bg-slate-950/40">
      <li
        className={classNames(
          "text-sm text-slate-400 hover:text-slate-400 font-semibold uppercase -tracking-wider cursor-pointer py-4 px-2 border-b-2 border-transparent",
          {
            "!border-slate-100 !text-slate-100": "headers" === active,
          }
        )}
        onClick={() => setActive("headers")}
      >
        Headers
      </li>
      {endpoint?.parameters && (
        <li
          className={classNames(
            "text-sm text-slate-400 hover:text-slate-400 font-semibold uppercase -tracking-wider cursor-pointer py-4 px-2 border-b-2 border-transparent",
            {
              "!border-slate-100 !text-slate-100": "parameters" === active,
            }
          )}
          onClick={() => setActive("parameters")}
        >
          Parameters
        </li>
      )}
      {endpoint?.body && (
        <li
          className={classNames(
            "text-sm text-slate-400 hover:text-slate-400 font-semibold uppercase -tracking-wider cursor-pointer py-4 px-2 border-b-2 border-transparent",
            {
              "!border-slate-100 !text-slate-100": "body" === active,
            }
          )}
          onClick={() => setActive("body")}
        >
          Body
        </li>
      )}
      <li
        className={classNames(
          "text-sm text-slate-400 hover:text-slate-400 font-semibold uppercase -tracking-wider cursor-pointer py-4 px-2 border-b-2 border-transparent",
          {
            "!border-slate-100 !text-slate-100": "snippet" === active,
          }
        )}
        onClick={() => setActive("snippet")}
      >
        Snippet
      </li>
    </ul>
  );
};
