{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cloudfacts.org/schemas/query-result.schema.json",
  "title": "CloudFacts Query Result",
  "type": "object",
  "properties": {
    "type": { "type": "string", "enum": ["CloudFactsQueryResult"] },
    "query": { "type": "object" },
    "sort": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "field": { "type": "string" },
          "direction": { "type": "string", "enum": ["asc", "desc"] }
        }
      }
    },
    "ranking": {
      "type": "object",
      "properties": {
        "metric": { "type": "string" },
        "direction": { "type": "string" },
        "tax_scenario": { "type": "string" }
      }
    },
    "matches": { "type": "integer", "minimum": 0 },
    "results": { "type": "array" }
  },
  "required": ["type", "query", "matches", "results"]
}