import { createContext } from 'react';
import { currentUserDetailsAtom } from '@/modules/auth/hooks/use-auth-hook';
import type { AuthResponseDtoUserDetailDto } from '@/sdk';
import { useAtomValue } from 'jotai';

export const AuthContext = createContext<AuthResponseDtoUserDetailDto | undefined>(undefined);

export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
  const authData = useAtomValue(currentUserDetailsAtom);
  return <AuthContext.Provider value={authData}>{children}</AuthContext.Provider>;
};
