import { createContext, useContext, useState } from "react";

export interface UserAuthenticationContextProps {
	isAuthenticated: boolean;
	setIsAuthenticated: React.Dispatch<React.SetStateAction<boolean>>;
}

export const UserAuthenticationContext = createContext<UserAuthenticationContextProps>({
	isAuthenticated: false,
	setIsAuthenticated: () => {},
});

export const UserAuthenticationContextProvider = ({ children }: { children: React.ReactNode }) => {
	const [isAuthenticated, setIsAuthenticated] = useState(false);

	return (
		<UserAuthenticationContext.Provider value={{ isAuthenticated: true, setIsAuthenticated }}>
			{children}
		</UserAuthenticationContext.Provider>
	);
};

export const useUserAuthenticationContext = () => {
	return useContext(UserAuthenticationContext);
};
