// // Copyright (c) StellaOps. Licensed under the AGPL-3.0-or-later. // using StellaOps.Findings.Ledger.Domain; namespace StellaOps.Findings.Ledger.Services; /// /// Hook interface for decision recording events. /// Implementations are called asynchronously after decision is persisted. /// /// /// Hooks are fire-and-forget; exceptions are logged but don't block the caller. /// SPRINT_20260107_006_004_BE Task: OM-007 /// public interface IDecisionHook { /// /// Called after a decision is recorded to the ledger. /// /// The recorded decision event. /// The tenant identifier. /// Cancellation token. /// A task representing the asynchronous operation. Task OnDecisionRecordedAsync( DecisionEvent decision, string tenantId, CancellationToken cancellationToken = default); } /// /// Context provided to decision hooks for enriched processing. /// public sealed record DecisionHookContext { /// /// The decision event that was recorded. /// public required DecisionEvent Decision { get; init; } /// /// The tenant identifier. /// public required string TenantId { get; init; } /// /// When the decision was persisted to the ledger. /// public required DateTimeOffset PersistedAt { get; init; } /// /// The ledger event sequence number, if available. /// public long? SequenceNumber { get; init; } }