import { api } from "./http";
import type { AuthTokens, AuthUser, LoginResponse } from "./types";

export const loginRequest = async (payload: {
  email: string;
  password: string;
}) => {
  const response = await api.post<LoginResponse>("/auth/login", payload);
  return response.data;
};

export const verifyMfaRequest = async (payload: {
  email: string;
  otp: string;
}) => {
  const response = await api.post<AuthTokens>("/auth/mfa-verify", payload);
  return response.data;
};

export const getMeRequest = async () => {
  const response = await api.get<AuthUser>("/me");
  return response.data;
};
