{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vetrade.vet/schemas/limit-order-list-response.schema.json",
  "title": "Limit Order List Response",
  "type": "object",
  "additionalProperties": false,
  "required": ["apiVersion", "requestId", "source", "maker", "filters", "orders", "pagination", "warnings"],
  "properties": {
    "apiVersion": {
      "type": "string",
      "const": "v2"
    },
    "requestId": {
      "type": "string"
    },
    "source": {
      "type": "string",
      "enum": ["on_chain", "api"]
    },
    "maker": {
      "type": "string"
    },
    "filters": {
      "type": "object",
      "additionalProperties": true
    },
    "orders": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/orderSummary"
      }
    },
    "pagination": {
      "type": "object",
      "additionalProperties": false,
      "required": ["currentPage", "totalPages", "totalItems", "pageSize"],
      "properties": {
        "currentPage": { "type": "integer" },
        "totalPages": { "type": "integer" },
        "totalItems": { "type": "integer" },
        "pageSize": { "type": "integer" }
      }
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["code", "message"],
        "properties": {
          "code": {
            "type": "string",
            "enum": ["ON_CHAIN_LIST_FALLBACK"]
          },
          "message": { "type": "string" }
        }
      }
    }
  },
  "$defs": {
    "orderSummary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "orderId",
        "maker",
        "inputToken",
        "outputToken",
        "amountIn",
        "amountOut",
        "amountFilled",
        "amountRemaining",
        "price",
        "targetPrice",
        "status",
        "statusNumber",
        "createdAt",
        "lastStatusChangeAt",
        "totalInputAmount",
        "totalOutputAmount",
        "fillProgressBps",
        "options"
      ],
      "properties": {
        "orderId": { "type": "string" },
        "maker": { "type": "string" },
        "inputToken": { "type": "string" },
        "outputToken": { "type": "string" },
        "amountIn": { "type": "string" },
        "amountOut": { "type": "string" },
        "amountFilled": { "type": "string" },
        "amountRemaining": { "type": "string" },
        "price": { "type": "string" },
        "targetPrice": { "type": "string" },
        "status": {
          "type": "string",
          "enum": ["OPEN", "PARTIALLY_FILLED", "FILLED", "CANCELLED"]
        },
        "statusNumber": { "type": "integer" },
        "createdAt": { "type": "integer" },
        "lastStatusChangeAt": { "type": "integer" },
        "totalInputAmount": { "type": "string" },
        "totalOutputAmount": { "type": "string" },
        "fillProgressBps": { "type": "integer" },
        "options": {
          "type": "object",
          "additionalProperties": false,
          "required": ["vvetUnwrap"],
          "properties": {
            "vvetUnwrap": { "type": "boolean" }
          }
        },
        "creationTxId": { "type": "string" }
      }
    }
  }
}
