"""Configuration constants for the feedback system."""

# Retry limits
MAX_KEYFRAME_FEEDBACK_ATTEMPTS = 2
MAX_VIDEO_FEEDBACK_ATTEMPTS = 1

# Cost ceilings (USD)
MAX_FEEDBACK_COST_PER_SHOT = 1.00
LVLM_DIAGNOSIS_COST = 0.039
LVLM_REWRITE_COST = 0.039

# Auto-injection thresholds (Gate 1 only)
AUTO_INJECT_SUCCESS_THRESHOLD = 3
AUTO_INJECT_REGRESSION_TOLERANCE = 0

# Severity ceiling — skip feedback if total gate severity exceeds this
SEVERITY_CEILING = 8

# Ref budget during feedback (fewer refs = less interference)
FEEDBACK_REF_BUDGET = 1  # Max refs during feedback pass (just hero)
NORMAL_REF_BUDGET = 3   # Max refs during normal generation

# Never-feedback categories — immediate escalation
NEVER_HEAL = frozenset([
    "content_filter",
    "api_timeout",
    "black_frame",
    "file_corrupt",
    "identity_wrong_person",
])

# CROP_TO_CLOSEUP feedback strategy guards
CROP_CLOSEUP_MIN_FRAMING_ORDER = 3    # MS (3) or wider — don't crop CU/MCU/ECU
CROP_CLOSEUP_BLOCKED_SHOT_TYPES = frozenset({"EWS", "WS", "OTS"})  # EWS/WS break narrative; OTS destroys listener half (PC-2 coverage value)
CROP_CLOSEUP_MIN_ATTEMPT = 2          # Only after all other strategies exhausted
CROP_CLOSEUP_MAX_CONSECUTIVE = 2      # Max 2 consecutive crops before ICU escalation
CROP_CLOSEUP_CREEP_THRESHOLD = 0.05   # >5% crop rate = upstream problem
