"use client";
import {
  SessionProvider as NextAuthProvider,
  useSession as useNextAuthSession,
} from "next-auth/react";
import { Session } from "next-auth";

export function SessionProvider({
  children,
  session,
}: {
  children: React.ReactNode;
  session: Session | null;
}) {
  return <NextAuthProvider session={session}>{children}</NextAuthProvider>;
}

export const useSession = () => {
  const session = useNextAuthSession();
  return {
    session: session.data,
    status: session.status,
    update: session.update,
  };
};
