import type { Metadata } from "next";
import AdminLoginForm from "@/components/admin/AdminLoginForm";
import { adminConfigurationStatus } from "@/lib/runtime/config";

export const metadata: Metadata = {
  title: "Admin Login | Funktechnik Schubert",
  robots: { index: false, follow: false },
};

export default async function AdminLoginPage({ searchParams }: { searchParams: Promise<{ next?: string }> }) {
  const params = await searchParams;
  const nextPath = params.next?.startsWith("/admin") ? params.next : "/admin";
  return <AdminLoginForm nextPath={nextPath} adminConfigured={adminConfigurationStatus() === "configured"} />;
}
