{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tradecat.local/contracts/tradecat-auto-paper-service-status.schema.json",
  "title": "TradeCat Auto Paper Service Status",
  "description": "Status/start/stop response for the local public-readonly paper/watch run-loop wrapper.",
  "type": "object",
  "required": [
    "schema",
    "schema_version",
    "ok",
    "mode",
    "real_orders",
    "signed_requests",
    "reads_api_keys",
    "command",
    "action",
    "state",
    "running",
    "runtime_dir",
    "safety"
  ],
  "properties": {
    "schema": {
      "const": "tradecat_auto.paper_service_status.v1"
    },
    "schema_version": {
      "const": "1.0.0"
    },
    "ok": {
      "type": "boolean"
    },
    "mode": {
      "const": "paper"
    },
    "real_orders": {
      "const": false
    },
    "signed_requests": {
      "const": false
    },
    "reads_api_keys": {
      "const": false
    },
    "command": {
      "const": "auto-paper-service"
    },
    "action": {
      "type": "string"
    },
    "state": {
      "type": "string"
    },
    "event": {
      "type": "string"
    },
    "running": {
      "type": "boolean"
    },
    "pid": {
      "type": [
        "integer",
        "null"
      ]
    },
    "runtime_dir": {
      "type": "string"
    },
    "state_path": {
      "type": "string"
    },
    "ledger_path": {
      "type": "string"
    },
    "archive_path": {
      "type": "string"
    },
    "journal_path": {
      "type": "string"
    },
    "log_file": {
      "type": "string"
    },
    "health": {
      "type": "string"
    },
    "process_health": {
      "type": "string",
      "description": "Process-level status from start-auto-paper.sh. Use health-report for full ledger/archive/audit heartbeat health."
    },
    "health_report_command": {
      "type": "string"
    },
    "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"
      }
    },
    "error": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
