using System.Text.Json; namespace XFEEDToolBox.Core.Execution; public sealed class NativeMarketSnapshotUnavailableException():IOException("原生市场只读快照尚未恢复新鲜;不会重发已确认的交易。") { public static bool IsFreshnessRejection(JsonElement row) =>row.TryGetProperty("state",out var state)&&state.ValueKind==JsonValueKind.Number&&state.GetInt32()==4 &&row.TryGetProperty("error",out var error)&&error.ValueKind==JsonValueKind.Number&&error.GetInt32()==1 &&row.TryGetProperty("mutationsSent",out var mutations)&&mutations.ValueKind==JsonValueKind.Number&&mutations.GetInt32()==0 &&(!row.TryGetProperty("reconciliationRequired",out var required)||required.ValueKind==JsonValueKind.False) &&!NativeOrderReconciliation.IsServerFailure(row); }