16 lines
480 B
C#
16 lines
480 B
C#
namespace Shared.Operations;
|
|
|
|
public static class ReconcilePolicy
|
|
{
|
|
public static string DecideStatus(
|
|
bool valuesMatch,
|
|
DateTimeOffset sourceChangedAt,
|
|
DateTimeOffset observedAt,
|
|
TimeSpan gracePeriod)
|
|
{
|
|
if (valuesMatch) return "matched";
|
|
if (observedAt < sourceChangedAt) throw new ArgumentOutOfRangeException(nameof(observedAt));
|
|
return observedAt - sourceChangedAt < gracePeriod ? "pending" : "mismatch";
|
|
}
|
|
}
|