namespace KArtSell.Modules.SignalEngine.Domain; public enum PolicyDisposition { NotApplicable = 0, Blocked = 1, Applied = 2 } public sealed record PolicyTraceEntry( string PolicyId, int Priority, PolicyDisposition Disposition, string ReasonCode, decimal RequestedSellRatioOfLot, decimal AppliedSellRatioOfLot, bool StrategicCoreClampApplied); public sealed record SellPolicyResult( PolicyTraceEntry Trace, SellDecision? Decision) { public static SellPolicyResult NotApplicable(string policyId, int priority, string reasonCode) => new(new PolicyTraceEntry(policyId, priority, PolicyDisposition.NotApplicable, reasonCode, 0m, 0m, false), null); public static SellPolicyResult Blocked( string policyId, int priority, string reasonCode, decimal requestedSellRatioOfLot = 0m) => new(new PolicyTraceEntry( policyId, priority, PolicyDisposition.Blocked, reasonCode, requestedSellRatioOfLot, 0m, false), null); public static SellPolicyResult Applied( SellDecision decision, decimal requestedSellRatioOfLot, bool strategicCoreClampApplied) => new(new PolicyTraceEntry( decision.PolicyId, decision.Priority, PolicyDisposition.Applied, decision.ReasonCode, requestedSellRatioOfLot, decision.SellRatioOfLot, strategicCoreClampApplied), decision); }