namespace KArtSell.Modules.ModelOperations.Domain;

public enum ModelLifecycleState
{
    Research,
    Challenger,
    Shadow,
    Candidate,
    Approved,
    Retired,
    RolledBack
}

public enum GateDecision
{
    Pass,
    Warn,
    Hold,
    Fail
}

public sealed record ModelEvaluationSnapshot(
    string ScopeKey,
    string ModelVersion,
    int ShadowTradingDays,
    int DistinctRegimes,
    decimal NetExpectedUtility,
    decimal FalseExitAnnualRate,
    decimal ReentryCaptureRate,
    decimal Pbo,
    decimal Dsr,
    bool PositiveUnderDoubleCost,
    int OperationalIntegrityErrors,
    bool CalibrationStable,
    DateTimeOffset AsOf);

public sealed record PromotionGateThresholds(
    int MinimumShadowTradingDays,
    int MinimumDistinctRegimes,
    decimal MaximumFalseExitAnnualRate,
    decimal MinimumReentryCaptureRate,
    decimal MaximumPbo,
    decimal MinimumDsr)
{
    public static PromotionGateThresholds ResearchBaseline { get; } = new(
        MinimumShadowTradingDays: 252,
        MinimumDistinctRegimes: 2,
        MaximumFalseExitAnnualRate: 0.02m,
        MinimumReentryCaptureRate: 0.65m,
        MaximumPbo: 0.20m,
        MinimumDsr: 0.95m);
}

public sealed record PromotionGateResult(
    GateDecision Decision,
    IReadOnlyList<string> BlockingReasons,
    IReadOnlyList<string> Warnings,
    bool RequiresIndependentValidation,
    bool RequiresHumanApproval,
    string Boundary);
