{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tradecat.local/contracts/tradecat-auto-strategy-review-report.schema.json",
  "title": "TradeCat Auto Strategy Review Report",
  "description": "Paper/watch outcome review that produces a local strategy_state.v1 filter.",
  "type": "object",
  "required": ["schema", "schema_version", "ok", "generated_at", "strategy_state", "provenance", "safety"],
  "properties": {
    "schema": {"const": "tradecat_auto.strategy_review_report.v1"},
    "schema_version": {"const": "1.0.0"},
    "ok": {"type": "boolean"},
    "error_code": {"type": ["string", "null"]},
    "generated_at": {"type": "string"},
    "ledger_path": {"type": "string"},
    "archive_path": {"type": "string"},
    "closed_positions_count": {"type": "integer", "minimum": 0},
    "open_positions_count": {"type": "integer", "minimum": 0},
    "review_status": {"type": "string"},
    "thresholds": {"type": "object", "additionalProperties": true},
    "metrics": {"type": "object", "additionalProperties": true},
    "recommendations": {"type": "object", "additionalProperties": true},
    "strategy_state": {"type": "object", "additionalProperties": true},
    "archive_errors": {"type": "array", "items": {"type": "object", "additionalProperties": true}},
    "provenance": {"type": "object", "additionalProperties": true},
    "safety": {
      "type": "object",
      "required": ["public_readonly_market_data", "public_readonly", "paper_or_watch_only", "real_orders", "signed_requests", "reads_api_keys", "binance_account_state"],
      "properties": {
        "public_readonly_market_data": {"const": true},
        "public_readonly": {"const": true},
        "paper_or_watch_only": {"const": true},
        "real_orders": {"const": false},
        "signed_requests": {"const": false},
        "reads_api_keys": {"const": false},
        "binance_account_state": {"const": false}
      },
      "additionalProperties": true
    },
    "limitations": {"type": "array", "items": {"type": "string"}}
  },
  "additionalProperties": true
}
