{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://henok.online/data/africa-intelligence/v1/query/query-schema.json",
  "title": "Africa Intelligence governed query",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "query",
    "filters",
    "sort",
    "limit"
  ],
  "properties": {
    "query": {
      "type": "string",
      "maxLength": 300
    },
    "mode": {
      "type": "string",
      "enum": [
        "QUICK_SEARCH",
        "EVIDENCE_SEARCH",
        "COUNTRY_SEARCH",
        "SOURCE_SEARCH",
        "COMPARISON_RETRIEVAL",
        "RESEARCH_GAP_SEARCH",
        "MACHINE_QUERY",
        "AI_RETRIEVAL"
      ],
      "default": "QUICK_SEARCH"
    },
    "filters": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "country": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "ZA",
              "NG",
              "KE",
              "EG",
              "MA",
              "GH",
              "UG",
              "ET"
            ]
          },
          "uniqueItems": true
        },
        "region": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "dimension": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "ai-compute",
              "cloud",
              "data-centre",
              "payments",
              "power"
            ]
          },
          "uniqueItems": true
        },
        "indicator": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "ind-cloud-big3-regions",
              "ind-cassava-signal",
              "ind-national-dc-operational-mw",
              "ind-digital-payments-comparable",
              "ind-grid-reliability-comparable",
              "ind-mobile-money-subscriptions",
              "ind-mobile-money-agents",
              "ind-mobile-money-penetration",
              "ind-mobile-money-registered-accounts",
              "ind-dc-capacity-active",
              "ind-dc-capacity-construction",
              "ind-dc-capacity-planned",
              "ind-dc-global-share",
              "ind-mobile-money-transaction-value",
              "ind-mobile-money-registered-global",
              "ind-mobile-money-active-global",
              "ind-mobile-money-activity-rate"
            ]
          },
          "uniqueItems": true
        },
        "entity": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "ent-henok-online",
              "ent-adca",
              "ent-rising-advisory",
              "ent-aws",
              "ent-microsoft",
              "ent-google-cloud",
              "ent-cassava",
              "ent-gsma",
              "ent-ca-kenya",
              "ent-cbk",
              "ent-equinix",
              "ent-city-cape-town",
              "ent-groundup",
              "ent-moneyweb",
              "ent-connecting-africa",
              "ent-nairametrics",
              "ent-businessday-ng",
              "ent-news24",
              "ent-techafrica-news",
              "ent-world-bank",
              "ent-iea",
              "ent-esmap"
            ]
          },
          "uniqueItems": true
        },
        "provider": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "ent-henok-online",
              "ent-adca",
              "ent-rising-advisory",
              "ent-aws",
              "ent-microsoft",
              "ent-google-cloud",
              "ent-cassava",
              "ent-gsma",
              "ent-ca-kenya",
              "ent-cbk",
              "ent-equinix",
              "ent-city-cape-town",
              "ent-groundup",
              "ent-moneyweb",
              "ent-connecting-africa",
              "ent-nairametrics",
              "ent-businessday-ng",
              "ent-news24",
              "ent-techafrica-news",
              "ent-world-bank",
              "ent-iea",
              "ent-esmap"
            ]
          },
          "uniqueItems": true
        },
        "evidenceStatus": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "VERIFIED",
              "OPERATIONAL",
              "ANNOUNCED",
              "PLANNED",
              "ESTIMATED",
              "DISPUTED",
              "UNAVAILABLE"
            ]
          },
          "uniqueItems": true
        },
        "confidence": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "HIGH",
              "MEDIUM",
              "INSUFFICIENT",
              "LOW"
            ]
          },
          "uniqueItems": true
        },
        "sourceClass": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "INDUSTRY_AGGREGATION",
              "OFFICIAL_INVENTORY",
              "COMPANY_ANNOUNCEMENT",
              "OFFICIAL_DATA",
              "SECONDARY_REPORT",
              "REFERENCE_DATASET"
            ]
          },
          "uniqueItems": true
        },
        "comparability": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "COMPARABLE",
              "PARTIALLY_COMPARABLE",
              "NOT_COMPARABLE",
              "CONTEXT_ONLY",
              "INSUFFICIENT_EVIDENCE"
            ]
          },
          "uniqueItems": true
        },
        "publicationDateFrom": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "publicationDateTo": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "observationDateFrom": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "observationDateTo": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "retrievalState": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "REACHABLE",
              "CARRIED_FORWARD",
              "BLOCKED_ON_RECHECK"
            ]
          },
          "uniqueItems": true
        },
        "release": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "africa-intelligence-operations-v1.0.0",
              "africa-intelligence-comparison-history-v1.0.0",
              "africa-intelligence-country-profiles-v1.0.0",
              "africa-intelligence-decision-workbench-v1.0.0",
              "africa-intelligence-distribution-layer-v1.0.0",
              "africa-intelligence-query-engine-v1.0.0"
            ]
          },
          "uniqueItems": true
        },
        "freshness": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "CURRENT_AT_EVIDENCE_CUTOFF",
              "REVIEWED_WITHIN_30_DAYS"
            ]
          },
          "uniqueItems": true
        }
      }
    },
    "sort": {
      "type": "string",
      "enum": [
        "relevance",
        "date_desc",
        "date_asc",
        "title"
      ],
      "default": "relevance"
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "default": 20
    }
  },
  "examples": [
    {
      "query": "Kenya AI infrastructure",
      "mode": "EVIDENCE_SEARCH",
      "filters": {
        "country": [
          "KE"
        ],
        "region": [],
        "dimension": [
          "cloud",
          "ai-compute"
        ],
        "indicator": [],
        "entity": [],
        "provider": [],
        "evidenceStatus": [
          "VERIFIED",
          "OPERATIONAL",
          "ANNOUNCED",
          "PLANNED"
        ],
        "confidence": [],
        "sourceClass": [],
        "comparability": [],
        "publicationDateFrom": null,
        "publicationDateTo": null,
        "observationDateFrom": null,
        "observationDateTo": null,
        "retrievalState": [],
        "release": [
          "africa-infra-v1.0.0"
        ],
        "freshness": []
      },
      "sort": "relevance",
      "limit": 20
    }
  ]
}
