| | | 1 | | using AsiBackbone.Core.Audit; |
| | | 2 | | using AsiBackbone.Core.HostIntegration; |
| | | 3 | | |
| | | 4 | | namespace AsiBackbone.Samples.NcatAuditCompletionAdapter; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Identifies how the NCAT source dispatcher should treat one completion handoff attempt. |
| | | 8 | | /// </summary> |
| | | 9 | | public enum NcatAuditCompletionDeliveryDisposition |
| | | 10 | | { |
| | | 11 | | /// <summary>The lifecycle event was durably appended and the source entry may be acknowledged.</summary> |
| | | 12 | | Delivered = 100, |
| | | 13 | | |
| | | 14 | | /// <summary>An equivalent lifecycle event already exists and the source entry may be acknowledged.</summary> |
| | | 15 | | Duplicate = 200, |
| | | 16 | | |
| | | 17 | | /// <summary>The handoff should be attempted again because lifecycle persistence did not complete.</summary> |
| | | 18 | | Retryable = 300, |
| | | 19 | | |
| | | 20 | | /// <summary>The handoff is valid but required decision evidence is not available yet.</summary> |
| | | 21 | | Deferred = 400, |
| | | 22 | | |
| | | 23 | | /// <summary>The handoff is invalid or conflicts with previously persisted idempotency evidence.</summary> |
| | | 24 | | Terminal = 500, |
| | | 25 | | |
| | | 26 | | /// <summary>The configured retry threshold was reached without a successful lifecycle append.</summary> |
| | | 27 | | DeadLetter = 600 |
| | | 28 | | } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Reports the normalized result of one NCAT audit-completion handoff attempt. |
| | | 32 | | /// </summary> |
| | 30 | 33 | | public sealed record NcatAuditCompletionDeliveryResult( |
| | 42 | 34 | | NcatAuditCompletionDeliveryDisposition Disposition, |
| | 12 | 35 | | string ReasonCode, |
| | 4 | 36 | | string? LifecycleEventId = null, |
| | 26 | 37 | | GovernedOperationExecutionReceipt? Receipt = null, |
| | 18 | 38 | | AuditResidueLifecycleEvent? LifecycleEvent = null, |
| | 32 | 39 | | string? FailureType = null) |
| | | 40 | | { |
| | | 41 | | /// <summary> |
| | | 42 | | /// Gets a value indicating whether the source completion entry may be marked delivered. |
| | | 43 | | /// </summary> |
| | | 44 | | public bool ShouldAcknowledgeSource => |
| | 12 | 45 | | Disposition is NcatAuditCompletionDeliveryDisposition.Delivered or NcatAuditCompletionDeliveryDisposition.Duplic |
| | | 46 | | } |