import { auth } from "@/auth";
import { getBootstrapSetupStatus } from "@/features/setup/server/setup-bootstrap.service";
import { redirect } from "next/navigation";

export default async function Page() {
  const setupStatus = await getBootstrapSetupStatus();

  if (!setupStatus.initialized) {
    return redirect("/administration/setup");
  }

  const session = await auth();

  if (!session?.user?.id) {
    return redirect("/auth/sign-in");
  } else {
    redirect("/dashboard/crm");
  }
}
