diff --git a/StabilityMatrix/Models/ProgressReport.cs b/StabilityMatrix/Models/ProgressReport.cs new file mode 100644 index 00000000..b6c700b1 --- /dev/null +++ b/StabilityMatrix/Models/ProgressReport.cs @@ -0,0 +1,46 @@ +namespace StabilityMatrix.Models; + +public struct ProgressReport +{ + /// + /// Progress value as percentage between 0 and 1. + /// + public double? Progress { get; init; } = 0; + /// + /// Current progress count. + /// + public ulong? Current { get; init; } = 0; + /// + /// Total progress count. + /// + public ulong? Total { get; init; } = 0; + public string? Title { get; init; } + public string? Message { get; init; } + public bool IsIndeterminate { get; init; } = false; + + public ProgressReport(double progress, string? title = null, string? message = null, bool isIndeterminate = false) + { + Progress = progress; + Title = title; + Message = message; + IsIndeterminate = isIndeterminate; + } + + public ProgressReport(ulong current, ulong total, string? title = null, string? message = null, bool isIndeterminate = false) + { + Current = current; + Total = total; + Progress = (double) current / total; + Title = title; + Message = message; + IsIndeterminate = isIndeterminate; + } + + public ProgressReport(ulong current, string? title = null, string? message = null) + { + Current = current; + Title = title; + Message = message; + IsIndeterminate = true; + } +}