namespace PLib.Application.Abstractions;
/// Produces (and caches on disk) a poster frame for a video file.
public interface IThumbnailGenerator
{
///
/// Returns the absolute path of the poster frame for ,
/// generating it if it is not cached yet. Returns null when no frame could be
/// extracted; a missing thumbnail is a normal outcome, not an error.
///
Task GetOrCreateAsync(
string videoPath,
TimeSpan? duration,
CancellationToken cancellationToken = default);
///
/// True when a previously generated poster frame is still present in the cache. The
/// cache directory is ordinary user-writable storage, so a path the library remembers
/// is not proof that the file behind it still exists.
///
bool IsAvailable(string? thumbnailPath);
///
/// Deletes cached frames that no library item points at any more, and returns how many
/// files were removed. Call only after a complete scan: anything not in
/// is treated as garbage.
///
Task PurgeUnusedAsync(
IReadOnlyCollection inUsePaths,
CancellationToken cancellationToken = default);
/// How much disk the cache currently occupies, in bytes.
Task GetCacheSizeInBytesAsync(CancellationToken cancellationToken = default);
/// Empties the cache completely. Returns how many files were removed.
Task ClearAsync(CancellationToken cancellationToken = default);
}