"use client"; import { createContext, useContext, useEffect, useState } from "react"; interface AuthContextType { user: { email: string; uid: string } | null; loading: boolean; signInWithGoogle: () => Promise; logout: () => Promise; } const AuthContext = createContext({} as AuthContextType); export function AuthProvider({ children }: { children: React.ReactNode }) { const [user, setUser] = useState<{ email: string; uid: string } | null>(null); const [loading, setLoading] = useState(true); useEffect(() => { // Simulation mode: Auto-login as guest after 1 second const timer = setTimeout(() => { setUser({ email: "guest@defrag.local", uid: "guest-simulation-mode" }); setLoading(false); }, 1000); return () => clearTimeout(timer); }, []); const signInWithGoogle = async () => { // Simulation: instant guest login setUser({ email: "guest@defrag.local", uid: "guest-simulation-mode" }); }; const logout = async () => { setUser(null); }; return ( {children} ); } export const useAuth = () => useContext(AuthContext);