{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.local/schemas/rollout_config.schema.json",
  "title": "RolloutConfig",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "stage",
    "effective_from",
    "max_portfolio_allocation_pct",
    "max_per_trade_risk_pct",
    "max_positions",
    "human_approval_mode",
    "freeze_conditions",
    "rollback_conditions"
  ],
  "properties": {
    "stage": {
      "type": "string",
      "enum": ["pilot_live", "controlled_live", "production_live"]
    },
    "effective_from": {
      "type": "string",
      "format": "date-time"
    },
    "max_portfolio_allocation_pct": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "max_per_trade_risk_pct": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "max_positions": {
      "type": "integer",
      "minimum": 1
    },
    "human_approval_mode": {
      "type": "string",
      "enum": ["always", "anomalies_only", "exceptions_only"]
    },
    "freeze_conditions": {
      "type": "array",
      "minItems": 1,
      "items": {"type": "string"}
    },
    "rollback_conditions": {
      "type": "array",
      "minItems": 1,
      "items": {"type": "string"}
    },
    "notes": {
      "type": "string"
    }
  }
}
