/ GUNRPG.Application / Backend / SyncResult.cs
SyncResult.cs
 1  namespace GUNRPG.Application.Backend;
 2  
 3  /// <summary>
 4  /// Represents the outcome of an offline-to-online exfil synchronization attempt.
 5  /// </summary>
 6  public sealed class SyncResult
 7  {
 8      public bool Success { get; init; }
 9      public int EnvelopesSynced { get; init; }
10      public string? FailureReason { get; init; }
11  
12      /// <summary>
13      /// True when failure is due to a permanent integrity violation (sequence gap or hash chain mismatch).
14      /// Integrity failures require re-infil to recover; transient HTTP failures allow retry.
15      /// </summary>
16      public bool IsIntegrityFailure { get; init; }
17  
18      public static SyncResult Ok(int envelopesSynced) =>
19          new() { Success = true, EnvelopesSynced = envelopesSynced };
20  
21      public static SyncResult Fail(string reason, bool isIntegrityFailure = false) =>
22          new() { Success = false, FailureReason = reason, IsIntegrityFailure = isIntegrityFailure };
23  }