namespace KArtSell.Modules.ModelOperations.ShadowRun.Events;
///
/// Published when a shadow run completes evaluation.
/// Idempotent: same RunId + attempt always produces same event.
/// Used by downstream consumers: approval workflows, notifications, reporting.
///
public sealed record ShadowRunCompletedEvent(
Guid RunId,
Guid ModelId,
Guid CorrelationId,
DateOnly WindowStartDate,
DateOnly WindowEndDate,
bool AllGatesPassed,
decimal TotalReturn,
decimal SharpeRatio,
decimal ProbOfBacktestOverfit,
decimal DailySharePercentile,
string? ErrorMessage,
DateTime CompletedAt)
{
///
/// Idempotency key ensures duplicate events are silently ignored.
/// Format: {RunId}#{Attempt}
///
public string IdempotencyKey => $"{RunId}#1";
}