{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tradecat.local/contracts/tradecat-auto-position-management-action-report.schema.json",
  "title": "TradeCat Auto Position Management Action Report",
  "description": "Result of applying one Agent/Hermes position_management_thesis.v1 to the local TradeCat paper ledger.",
  "type": "object",
  "required": [
    "schema",
    "schema_version",
    "ok",
    "mode",
    "action",
    "status",
    "error_code",
    "ledger_mutated",
    "provenance",
    "safety"
  ],
  "properties": {
    "schema": {"const": "tradecat_auto.position_management_action_report.v1"},
    "schema_version": {"const": "1.0.0"},
    "ok": {"type": "boolean"},
    "mode": {"enum": ["paper", "watch"]},
    "action": {"enum": ["hold", "noop", "close", "adjust_exit", "add", "reduce"]},
    "status": {"enum": ["HELD", "NOOP", "APPLIED", "REJECTED", "UNSUPPORTED", "ERROR"]},
    "error_code": {"type": ["string", "null"]},
    "reason": {"type": "string"},
    "symbol": {"type": "string"},
    "position_id": {"type": "string"},
    "position_ref": {"type": "object", "additionalProperties": true},
    "ledger_mutated": {"type": "boolean"},
    "action_id": {"type": "string", "minLength": 1},
    "updated_fields": {"type": "array", "items": {"type": "string"}},
    "paper_ledger_summary": {"type": "object", "additionalProperties": true},
    "ledger_path": {"type": "string"},
    "audit_journal": {"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
    }
  },
  "additionalProperties": true
}
