import { booksApi } from "@/api/books";
import { getReadingProgress } from "@/api/reader";
import type { ReadingProgress } from "@/types/reader";

export async function loadEbookWithProgress(bookId: number): Promise<{
  progressData: ReadingProgress | null;
  blob: Blob;
}> {
  const [progressData, blob] = await Promise.all([
    getReadingProgress(bookId).catch(() => null),
    booksApi.getEbookFile(bookId),
  ]);
  return { progressData, blob };
}
