import { redirect } from "next/navigation";
import { headers } from "next/headers";
import { auth } from "@/lib/auth";

export default async function HomePage() {
  const session = await auth.api.getSession({ headers: await headers() });

  if (!session) {
    redirect("/login");
  }

  const role = session.user.role;

  if (role === "admin") redirect("/admin/dashboard");
  if (role === "curator") redirect("/curator/dashboard");
  redirect("/dashboard");
}
