import { createContext, useContext } from 'react'; export interface AuthValue { authed: boolean; isAdmin: boolean; roles: string[]; userEmail: string | null; login: (email: string, password: string, orgId?: string) => Promise; logout: () => void; } export const AuthCtx = createContext(null); export function useAuth(): AuthValue { const v = useContext(AuthCtx); if (!v) throw new Error('useAuth must be used within '); return v; }