import { atom } from 'jotai';

export interface AuthUser {
  userId: string;
  email: string;
  token: string;
}

/** Currently authenticated user, or null when logged out */
export const authAtom = atom<AuthUser | null>(null);

/**
 * True while the app is reading the stored token on startup.
 * Prevents the auth screen from flashing before the check completes.
 */
export const isAuthLoadingAtom = atom<boolean>(true);
