| | | 1 | | using AsiBackbone.Core.Audit; |
| | | 2 | | using AsiBackbone.Core.Emissions; |
| | | 3 | | using AsiBackbone.Core.Entities; |
| | | 4 | | using AsiBackbone.Core.Serialization; |
| | | 5 | | |
| | | 6 | | namespace AsiBackbone.EntityFrameworkCore.Persistence; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Represents the Entity Framework Core persistence shape for a durable governance outbox entry. |
| | | 10 | | /// </summary> |
| | | 11 | | public sealed class AsiBackboneGovernanceOutboxEntryEntity : AsiBackboneEntity |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Gets or sets the stable outbox entry identifier. |
| | | 15 | | /// </summary> |
| | 356 | 16 | | public string OutboxEntryId { get; set; } = string.Empty; |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// Gets or sets the provider-neutral outbox status. |
| | | 20 | | /// </summary> |
| | 356 | 21 | | public GovernanceEmissionStatus Status { get; set; } = GovernanceEmissionStatus.Pending; |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Gets or sets the UTC timestamp when the entry was created. |
| | | 25 | | /// </summary> |
| | 172 | 26 | | public DateTimeOffset CreatedUtc { get; set; } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Gets or sets the UTC timestamp when the entry was last updated. |
| | | 30 | | /// </summary> |
| | 172 | 31 | | public DateTimeOffset UpdatedUtc { get; set; } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Gets or sets the UTC timestamp when delivery completed, when applicable. |
| | | 35 | | /// </summary> |
| | 76 | 36 | | public DateTimeOffset? DeliveredUtc { get; set; } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Gets or sets the failed or deferred attempt count. |
| | | 40 | | /// </summary> |
| | 172 | 41 | | public int RetryCount { get; set; } |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// Gets or sets the maximum retry count before dead-lettering. |
| | | 45 | | /// </summary> |
| | 172 | 46 | | public int MaxRetryCount { get; set; } |
| | | 47 | | |
| | | 48 | | /// <summary> |
| | | 49 | | /// Gets or sets the next UTC retry timestamp, when retry scheduling is active. |
| | | 50 | | /// </summary> |
| | 172 | 51 | | public DateTimeOffset? NextRetryUtc { get; set; } |
| | | 52 | | |
| | | 53 | | /// <summary> |
| | | 54 | | /// Gets or sets the provider name associated with the most recent attempt, when available. |
| | | 55 | | /// </summary> |
| | 172 | 56 | | public string? ProviderName { get; set; } |
| | | 57 | | |
| | | 58 | | /// <summary> |
| | | 59 | | /// Gets or sets the provider-side record identifier, when delivery returned one and it is safe to store. |
| | | 60 | | /// </summary> |
| | 172 | 61 | | public string? ProviderRecordId { get; set; } |
| | | 62 | | |
| | | 63 | | /// <summary> |
| | | 64 | | /// Gets or sets the terminal dead-letter reason, when available. |
| | | 65 | | /// </summary> |
| | 172 | 66 | | public string? DeadLetterReason { get; set; } |
| | | 67 | | |
| | | 68 | | /// <summary> |
| | | 69 | | /// Gets or sets the last provider-neutral error code, when available. |
| | | 70 | | /// </summary> |
| | 196 | 71 | | public string? LastErrorCode { get; set; } |
| | | 72 | | |
| | | 73 | | /// <summary> |
| | | 74 | | /// Gets or sets the last provider-neutral diagnostic message, when available. |
| | | 75 | | /// </summary> |
| | 124 | 76 | | public string? LastErrorMessage { get; set; } |
| | | 77 | | |
| | | 78 | | /// <summary> |
| | | 79 | | /// Gets or sets a value indicating whether the last error is retryable. |
| | | 80 | | /// </summary> |
| | 100 | 81 | | public bool? LastErrorIsRetryable { get; set; } |
| | | 82 | | |
| | | 83 | | /// <summary> |
| | | 84 | | /// Gets or sets the provider name associated with the last error, when available. |
| | | 85 | | /// </summary> |
| | 100 | 86 | | public string? LastErrorProviderName { get; set; } |
| | | 87 | | |
| | | 88 | | /// <summary> |
| | | 89 | | /// Gets or sets the provider-specific last error code, when safe and available. |
| | | 90 | | /// </summary> |
| | 100 | 91 | | public string? LastErrorProviderErrorCode { get; set; } |
| | | 92 | | |
| | | 93 | | /// <summary> |
| | | 94 | | /// Gets or sets serialized framework-neutral outbox metadata. |
| | | 95 | | /// </summary> |
| | 356 | 96 | | public string MetadataJson { get; set; } = "{}"; |
| | | 97 | | |
| | | 98 | | /// <summary> |
| | | 99 | | /// Gets or sets the stable envelope identifier. |
| | | 100 | | /// </summary> |
| | 356 | 101 | | public string EnvelopeId { get; set; } = string.Empty; |
| | | 102 | | |
| | | 103 | | /// <summary> |
| | | 104 | | /// Gets or sets the envelope schema version. |
| | | 105 | | /// </summary> |
| | 356 | 106 | | public string EnvelopeSchemaVersion { get; set; } = AsiBackboneSchemaVersions.StableArtifactsV1; |
| | | 107 | | |
| | | 108 | | /// <summary> |
| | | 109 | | /// Gets or sets the provider-neutral envelope event type. |
| | | 110 | | /// </summary> |
| | 172 | 111 | | public GovernanceEmissionEventType EnvelopeEventType { get; set; } |
| | | 112 | | |
| | | 113 | | /// <summary> |
| | | 114 | | /// Gets or sets the source governance event identifier, when available. |
| | | 115 | | /// </summary> |
| | 172 | 116 | | public string? EnvelopeEventId { get; set; } |
| | | 117 | | |
| | | 118 | | /// <summary> |
| | | 119 | | /// Gets or sets the UTC timestamp when the source governance event occurred. |
| | | 120 | | /// </summary> |
| | 172 | 121 | | public DateTimeOffset EnvelopeOccurredUtc { get; set; } |
| | | 122 | | |
| | | 123 | | /// <summary> |
| | | 124 | | /// Gets or sets the UTC timestamp when the envelope was created. |
| | | 125 | | /// </summary> |
| | 172 | 126 | | public DateTimeOffset EnvelopeCreatedUtc { get; set; } |
| | | 127 | | |
| | | 128 | | /// <summary> |
| | | 129 | | /// Gets or sets the envelope correlation identifier, when available. |
| | | 130 | | /// </summary> |
| | 172 | 131 | | public string? EnvelopeCorrelationId { get; set; } |
| | | 132 | | |
| | | 133 | | /// <summary> |
| | | 134 | | /// Gets or sets the envelope audit residue identifier, when available. |
| | | 135 | | /// </summary> |
| | 172 | 136 | | public string? EnvelopeAuditResidueId { get; set; } |
| | | 137 | | |
| | | 138 | | /// <summary> |
| | | 139 | | /// Gets or sets the envelope lifecycle stage, when available. |
| | | 140 | | /// </summary> |
| | 172 | 141 | | public AuditResidueLifecycleStage? EnvelopeLifecycleStage { get; set; } |
| | | 142 | | |
| | | 143 | | /// <summary> |
| | | 144 | | /// Gets or sets the stable lifecycle stage sequence value, when available. |
| | | 145 | | /// </summary> |
| | 76 | 146 | | public int? EnvelopeLifecycleStageSequence { get; set; } |
| | | 147 | | |
| | | 148 | | /// <summary> |
| | | 149 | | /// Gets or sets the envelope policy version, when available. |
| | | 150 | | /// </summary> |
| | 172 | 151 | | public string? EnvelopePolicyVersion { get; set; } |
| | | 152 | | |
| | | 153 | | /// <summary> |
| | | 154 | | /// Gets or sets the envelope policy hash, when available. |
| | | 155 | | /// </summary> |
| | 172 | 156 | | public string? EnvelopePolicyHash { get; set; } |
| | | 157 | | |
| | | 158 | | /// <summary> |
| | | 159 | | /// Gets or sets the envelope trace identifier, when available. |
| | | 160 | | /// </summary> |
| | 172 | 161 | | public string? EnvelopeTraceId { get; set; } |
| | | 162 | | |
| | | 163 | | /// <summary> |
| | | 164 | | /// Gets or sets the envelope span identifier, when available. |
| | | 165 | | /// </summary> |
| | 172 | 166 | | public string? EnvelopeSpanId { get; set; } |
| | | 167 | | |
| | | 168 | | /// <summary> |
| | | 169 | | /// Gets or sets the envelope parent span identifier, when available. |
| | | 170 | | /// </summary> |
| | 172 | 171 | | public string? EnvelopeParentSpanId { get; set; } |
| | | 172 | | |
| | | 173 | | /// <summary> |
| | | 174 | | /// Gets or sets the envelope operation name, when available. |
| | | 175 | | /// </summary> |
| | 172 | 176 | | public string? EnvelopeOperationName { get; set; } |
| | | 177 | | |
| | | 178 | | /// <summary> |
| | | 179 | | /// Gets or sets the envelope outcome, when available. |
| | | 180 | | /// </summary> |
| | 172 | 181 | | public string? EnvelopeOutcome { get; set; } |
| | | 182 | | |
| | | 183 | | /// <summary> |
| | | 184 | | /// Gets or sets the envelope actor identifier, when available. |
| | | 185 | | /// </summary> |
| | 172 | 186 | | public string? EnvelopeActorId { get; set; } |
| | | 187 | | |
| | | 188 | | /// <summary> |
| | | 189 | | /// Gets or sets the envelope emitter status, when available. |
| | | 190 | | /// </summary> |
| | 172 | 191 | | public string? EnvelopeEmitterStatus { get; set; } |
| | | 192 | | |
| | | 193 | | /// <summary> |
| | | 194 | | /// Gets or sets the envelope emitter provider, when available. |
| | | 195 | | /// </summary> |
| | 172 | 196 | | public string? EnvelopeEmitterProvider { get; set; } |
| | | 197 | | |
| | | 198 | | /// <summary> |
| | | 199 | | /// Gets or sets the envelope outbox sequence, when available. |
| | | 200 | | /// </summary> |
| | 172 | 201 | | public long? EnvelopeOutboxSequence { get; set; } |
| | | 202 | | |
| | | 203 | | /// <summary> |
| | | 204 | | /// Gets or sets the envelope gateway execution identifier, when available. |
| | | 205 | | /// </summary> |
| | 172 | 206 | | public string? EnvelopeGatewayExecutionId { get; set; } |
| | | 207 | | |
| | | 208 | | /// <summary> |
| | | 209 | | /// Gets or sets the envelope decision stage, when available. |
| | | 210 | | /// </summary> |
| | 172 | 211 | | public string? EnvelopeDecisionStage { get; set; } |
| | | 212 | | |
| | | 213 | | /// <summary> |
| | | 214 | | /// Gets or sets serialized framework-neutral envelope metadata. |
| | | 215 | | /// </summary> |
| | 356 | 216 | | public string EnvelopeMetadataJson { get; set; } = "{}"; |
| | | 217 | | |
| | | 218 | | /// <summary> |
| | | 219 | | /// Gets or sets the minimized payload type, when available. |
| | | 220 | | /// </summary> |
| | 194 | 221 | | public string? EnvelopePayloadType { get; set; } |
| | | 222 | | |
| | | 223 | | /// <summary> |
| | | 224 | | /// Gets or sets the minimized payload schema version, when available. |
| | | 225 | | /// </summary> |
| | 98 | 226 | | public string? EnvelopePayloadSchemaVersion { get; set; } |
| | | 227 | | |
| | | 228 | | /// <summary> |
| | | 229 | | /// Gets or sets the minimized payload content type, when available. |
| | | 230 | | /// </summary> |
| | 98 | 231 | | public string? EnvelopePayloadContentType { get; set; } |
| | | 232 | | |
| | | 233 | | /// <summary> |
| | | 234 | | /// Gets or sets the minimized payload content hash, when available. |
| | | 235 | | /// </summary> |
| | 98 | 236 | | public string? EnvelopePayloadContentHash { get; set; } |
| | | 237 | | |
| | | 238 | | /// <summary> |
| | | 239 | | /// Gets or sets the minimized payload size in bytes, when available. |
| | | 240 | | /// </summary> |
| | 98 | 241 | | public long? EnvelopePayloadSizeBytes { get; set; } |
| | | 242 | | |
| | | 243 | | /// <summary> |
| | | 244 | | /// Gets or sets serialized framework-neutral payload metadata. |
| | | 245 | | /// </summary> |
| | 282 | 246 | | public string EnvelopePayloadMetadataJson { get; set; } = "{}"; |
| | | 247 | | } |