using System.Threading.Tasks;
using API.Entities;
namespace API.Interfaces.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).
        /// 
        /// 
        /// Chapter for the passed chapterId. Side-effect from ensuring cache.
        Task Ensure(int chapterId);
        /// 
        /// Clears cache directory of all folders and files.
        /// 
        void Cleanup();
        /// 
        /// 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(int[] chapterIds);
        
        /// 
        /// Returns the absolute path of a cached page. 
        /// 
        /// Chapter entity with Files populated.
        /// Page number to look for
        /// 
        Task<(string path, MangaFile file)> GetCachedPagePath(Chapter chapter, int page);
        void EnsureCacheDirectory();
    }
}