import type { GUID } from '@/types/commonTypes';
import { createContext } from 'react';

export interface UserInfo {
  picture: string;
  firstName: string;
  lastName: string;
  fullName: string;
  email: string;
  phoneNumber: string;
  userID: GUID;
}

type AuthContextType = {
  accessToken: string | null;
  getToken: () => string | null;
  login: (tokens: {
    access_token: string;
    refresh_token: string;
    expires_in: number;
  }) => void;
  logout: () => void;
  authFinished: boolean;
  userInfo: UserInfo;
};

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