from myfasthtml.auth.utils import login_user, save_user_info, register_user
from myfasthtml.core.instances import SingleInstance


class AuthProxy(SingleInstance):
  def __init__(self, parent, base_url: str = None):
    super().__init__(parent)
    self._base_url = base_url
  
  def login_user(self, email: str, password: str):
    return login_user(email, password, self._base_url)
  
  def register_user(self, email: str, username: str, password: str):
    return register_user(email, username, password, self._base_url)
  
  def save_user_info(self, access_token: str, user_profile: dict):
    return save_user_info(access_token, user_profile, self._base_url)
