using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Kavita.Models.DTOs.Reader;
using Kavita.Models.Entities;
namespace Kavita.API.Services;
public interface ICacheService
{
///
/// Ensures the cache is created for the given chapter and if not, will create it. Should be called before any other
/// cache operations (except cleanup).
///
///
/// Extracts a PDF into images for a different reading experience
///
/// Chapter for the passed chapterId. Side-effect from ensuring cache.
Task Ensure(int chapterId, bool extractPdfToImages = false, CancellationToken ct = default);
///
/// Clears cache directory of all volumes. This can be invoked from deleting a library or a series.
///
/// Volumes that belong to that library. Assume the library might have been deleted before this invocation.
void CleanupChapters(IEnumerable chapterIds);
void CleanupBookmarks(IEnumerable seriesIds);
string GetCachedPagePath(int chapterId, int page);
string GetCachePath(int chapterId);
string GetBookmarkCachePath(int seriesId);
IEnumerable GetCachedPages(int chapterId);
IEnumerable GetCachedFileDimensions(string cachePath);
string GetCachedBookmarkPagePath(int seriesId, int page);
string GetCachedFile(Chapter chapter);
string GetCachedFile(int chapterId, string firstFilePath);
public void ExtractChapterFiles(string extractPath, IReadOnlyList files, bool extractPdfImages = false);
Task CacheBookmarkForSeries(int userId, int seriesId, CancellationToken ct = default);
void CleanupBookmarkCache(int seriesId);
}