export const dynamic = "force-dynamic";

import { headers } from "next/headers";
import { CustomerAdminEntry } from "@/components/customer-admin-entry";
import { MailLoginEntry } from "@/components/mail-login-entry";
import { PlatformKeyLoginEntry } from "@/components/platform-key-login-entry";
import { resolveManageHost, stripPort } from "@/lib/site-config";

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

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

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

  return <MailLoginEntry />;
}
