"use client"

import { useEffect } from "react"
import { useRouter } from "next/navigation"
import { getAuth } from "@/lib/auth-client"

export default function ParentPage() {
  const auth = getAuth()
  const { data: session, isPending } = auth?.useSession() ?? { data: null, isPending: false }
  const router = useRouter()

  useEffect(() => {
    if (isPending) return
    if (session) {
      router.replace("/parent/dashboard")
    } else {
      router.replace("/parent/auth/login")
    }
  }, [session, isPending, router])

  return null
}
