import { getServerSession } from "next-auth";
import { redirect } from "next/navigation";
import { authOptions } from "@/config/authConfig";
import { I18nProvider } from "@/i18n";
import LoginPage from "@/components/LoginPage/LoginPage";

const Login: React.FC = async () => {
  const session = await getServerSession(authOptions);
  if (session?.user) {
    redirect("/");
  }

  return (
    <I18nProvider namespaces={["login"]}>
      <LoginPage />
    </I18nProvider>
  );
};

export default Login;
