import { CopyButton } from "@/components/dashboard/copy-button";
import { CreateKeyButton } from "@/components/dashboard/create-key-button";
import { Navbar } from "@/components/dashboard/navbar";
import { PageHeader } from "@/components/dashboard/page-header";
import { Badge } from "@/components/ui/badge";
// import { getTenantId } from "@/lib/auth";
// import { db } from "@/lib/db";
import { notFound } from "next/navigation";
import { PropsWithChildren } from "react";

type Props = PropsWithChildren<{
  params: {
    staffId: string;
  };
}>;

export const dynamic = "force-dynamic";
export const runtime = "edge";

export default async function ApiPageLayout(props: Props) {
  // const tenantId = getTenantId();

  // const api = await db.query.apis.findFirst({
  //   where: (table, { eq, and, isNull }) =>
  //     and(eq(table.id, props.params.apiId), isNull(table.deletedAt)),
  //   with: {
  //     workspace: true,
  //   },
  // });
  // if (!api || api.workspace.tenantId !== tenantId) {
  //   return notFound();
  // }

  // const api = {
  //   id: "abcfdds"
  // }
  const navigation = [
    {
      label: "概述",
      href: `/manage/staffs/${props.params.staffId}`,
      segment: null,
    },
    // {
    //   label: "Keys",
    //   href: `/manage/keys/${api.keyAuthId}`,
    //   segment: "keys",
    // },

    {
      label: "设置",
      href: `/manage/staffs/${props.params.staffId}/settings`,
      segment: "settings",
    },
  ];

  // if (typeof window !== 'undefined') {
  //   URL = `${window.location.origin}/staffai/${props.params.apiId}`
  // }

  return (
    <div>

      <Navbar navigation={navigation} className="z-20" />

      <main className="relative mt-8 mb-20 ">{props.children}</main>
    </div>
  );
}
