"use client"

import * as React from "react"
import { SessionProvider } from "next-auth/react"
import type { Session } from "next-auth"

interface AuthSessionProviderProps {
  children: React.ReactNode
  /** SSR 期间获取的 session，避免 client 端异步获取导致的 hydration mismatch */
  session?: Session | null
}

export function AuthSessionProvider({ children, session }: AuthSessionProviderProps) {
  return (
    <SessionProvider session={session} refetchOnWindowFocus={false} refetchInterval={0}>
      {children}
    </SessionProvider>
  )
}

