import { AuthStorage } from "@/data/storage/auth/auth_storage";
import type { IAuthStorage } from "@/data/storage/auth";

export async function hasBusinessLoginToken(): Promise<boolean> {
  return hasCompleteBusinessAuthSession(AuthStorage.getInstance());
}

export async function hasCompleteBusinessAuthSession(
  storage: IAuthStorage,
): Promise<boolean> {
  const loginTokenResult = await storage.getLoginToken();
  if (!loginTokenResult.success || !loginTokenResult.data) return false;

  const refreshTokenResult = await storage.getRefreshToken();
  return refreshTokenResult.success && Boolean(refreshTokenResult.data);
}
