{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tradecat.local/contracts/tradecat-auto-paper-web-monitor-decision-text.schema.json",
  "title": "TradeCat Auto Paper Web Monitor Decision Text",
  "description": "Auditable decision text shown by the local read-only paper/watch web monitor.",
  "type": "object",
  "required": [
    "schema",
    "schema_version",
    "ok",
    "error_code",
    "text",
    "sections",
    "provenance",
    "safety",
    "limitations"
  ],
  "properties": {
    "schema": {
      "const": "tradecat_auto.paper_web_monitor_decision_text.v1"
    },
    "schema_version": {
      "const": "1.0.0"
    },
    "ok": {
      "type": "boolean"
    },
    "error_code": {
      "type": [
        "string",
        "null"
      ]
    },
    "symbol": {
      "type": [
        "string",
        "null"
      ]
    },
    "direction": {
      "type": [
        "string",
        "null"
      ]
    },
    "decision": {
      "type": [
        "string",
        "null"
      ]
    },
    "paper_execution_status": {
      "type": [
        "string",
        "null"
      ]
    },
    "text": {
      "type": "string"
    },
    "sections": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "title",
          "text"
        ],
        "properties": {
          "title": {
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        },
        "additionalProperties": true
      }
    },
    "provenance": {
      "type": "object",
      "required": [
        "source"
      ],
      "properties": {
        "source": {
          "type": "string"
        },
        "cycle_schema": {
          "type": "string"
        },
        "pipeline_schema": {
          "type": "string"
        },
        "paper_execution_id": {
          "type": "string"
        },
        "event_id": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "safety": {
      "$ref": "#/$defs/safety"
    },
    "limitations": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "additionalProperties": true,
  "$defs": {
    "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
    }
  }
}
