export const dynamic = "force-dynamic";

import { headers } from "next/headers";
import { CustomerAdminEntry } from "@/components/customer-admin-entry";
import { MailWorkspaceEntry } from "@/components/mail-workspace-entry";
import { ManageConsoleEntry } from "@/components/manage-console-entry";
import { resolveManageHost, stripPort } from "@/lib/site-config";

export default async function Page() {
  if (process.env.NEXT_BASE_PATH === "/admin") {
    return <CustomerAdminEntry />;
  }

  const headerList = await headers();
  const host = stripPort(headerList.get("host") || "");

  if (host === resolveManageHost()) {
    return <ManageConsoleEntry />;
  }

  return <MailWorkspaceEntry />;
}
