OF-DL/OF DL/Services/IDownloadEventHandler.cs

64 lines
2.1 KiB
C#

using OF_DL.Models;
namespace OF_DL.Services;
/// <summary>
/// UI callback contract for download orchestration. Implementations handle
/// status display, progress bars, and notifications in a UI-framework-specific way.
/// </summary>
public interface IDownloadEventHandler
{
/// <summary>
/// Wraps work in a status indicator (spinner) during API fetching.
/// The implementation controls how the status is displayed.
/// </summary>
Task<T> WithStatusAsync<T>(string statusMessage, Func<IStatusReporter, Task<T>> work);
/// <summary>
/// Wraps work in a progress bar during downloading.
/// The implementation controls how progress is displayed.
/// </summary>
Task<T> WithProgressAsync<T>(string description, long maxValue, bool showSize,
Func<IProgressReporter, Task<T>> work);
/// <summary>
/// Called when content of a specific type is found for a creator.
/// </summary>
void OnContentFound(string contentType, int mediaCount, int objectCount);
/// <summary>
/// Called when no content of a specific type is found for a creator.
/// </summary>
void OnNoContentFound(string contentType);
/// <summary>
/// Called when downloading of a content type completes.
/// </summary>
void OnDownloadComplete(string contentType, DownloadResult result);
/// <summary>
/// Called when starting to process a specific user/creator.
/// </summary>
void OnUserStarting(string username);
/// <summary>
/// Called when all downloads for a user/creator are complete.
/// </summary>
void OnUserComplete(string username, CreatorDownloadResult result);
/// <summary>
/// Called when a purchased tab user's downloads are complete.
/// </summary>
void OnPurchasedTabUserComplete(string username, int paidPostCount, int paidMessagesCount);
/// <summary>
/// Called when the entire scrape operation completes.
/// </summary>
void OnScrapeComplete(TimeSpan elapsed);
/// <summary>
/// General status message display.
/// </summary>
void OnMessage(string message);
}