using OF_DL.Services;

namespace OF_DL.Gui.Services;

internal sealed class AvaloniaStatusReporter(
    Action<string> statusAction,
    Func<bool> isCancellationRequested) : IStatusReporter
{
    public void ReportStatus(string message)
    {
        if (isCancellationRequested())
        {
            throw new OperationCanceledException("Operation canceled by user.");
        }

        statusAction(message);
    }
}
