using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Kavita.Models.DTOs.Reader;
using Kavita.Models.Entities;
using Kavita.Models.Entities.Enums;
using Kavita.Models.Metadata;
using Kavita.Models.Parser;
using VersOne.Epub;
namespace Kavita.API.Services;
public interface IBookService
{
int GetNumberOfPages(string filePath);
string GetCoverImage(string fileFilePath, string fileName, string outputDirectory, EncodeFormat encodeFormat, CoverImageSize size = CoverImageSize.Default);
ComicInfo? GetComicInfo(string filePath);
ParserInfo? ParseInfo(string filePath);
///
/// Scopes styles to .reading-section and replaces img src to the passed apiBase
///
///
///
/// If the stylesheetHtml contains Import statements, when scoping the filename, scope needs to be wrt filepath.
/// Book Reference, needed for if you expect Import statements
///
///
Task ScopeStyles(string stylesheetHtml, string apiBase, string filename, EpubBookRef book, CancellationToken ct = default);
///
/// Extracts a PDF file's pages as images to a target directory
///
/// This method relies on Docnet which has explicit patches from Kavita for ARM support. This should only be used with Tachiyomi
///
/// Where the files will be extracted to. If doesn't exist, will be created.
void ExtractPdfImages(string fileFilePath, string targetDirectory);
Task> GenerateTableOfContents(Chapter chapter, CancellationToken ct = default);
///
/// This returns a single page within the epub book. All html will be rewritten to be scoped within our reader,
/// all css is scoped, etc.
///
///
/// The requested page
/// The chapterId
/// The path to the cached epub file
/// The API base for Kavita, to rewrite urls to so we load though our endpoint
///
///
///
/// Full epub HTML Page, scoped to Kavita's reader
/// All exceptions throw this
Task GetBookPage(int userId, int page, int chapterId, string cachedEpubPath, string baseUrl, List ptocBookmarks, List annotations, CancellationToken ct = default);
Task> CreateKeyToPageMappingAsync(EpubBookRef book, CancellationToken ct = default);
Task?> GetWordCountsPerPage(string bookFilePath, CancellationToken ct = default);
Task GetWordCountBetweenXPaths(string bookFilePath, string startXpath, int startPage, string endXpath, int endPage, CancellationToken ct = default);
Task CopyImageToTempFromBook(int chapterId, BookmarkDto bookmarkDto, string cachedBookPath, CancellationToken ct = default);
Task GetResourceAsync(string bookFilePath, string requestedKey, CancellationToken ct = default);
}