{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/citeladder-com/json-schema/citeladder-com-ai-traffic-pages-schema.json",
  "title": "AiTrafficPages",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/citeladder-com-ai-traffic-api-openapi.yml#/components/schemas/AiTrafficPages",
  "type": "object",
  "properties": {
    "window_start": {
      "type": "string"
    },
    "window_end": {
      "type": "string"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "url_hash": {
            "type": "string"
          },
          "canonical_url": {
            "type": "string"
          },
          "display_path": {
            "type": "string"
          },
          "folder": {
            "type": "string"
          },
          "resource_class": {
            "type": "string"
          },
          "crawl": {
            "$ref": "#/$defs/TrafficLeg"
          },
          "referrals": {
            "$ref": "#/$defs/TrafficLeg"
          },
          "citations": {
            "$ref": "#/$defs/TrafficLeg"
          },
          "findings": {
            "$ref": "#/$defs/TrafficLeg"
          },
          "key_events": {
            "type": [
              "number",
              "null"
            ]
          },
          "last_crawl": {
            "type": [
              "string",
              "null"
            ]
          },
          "errors_4xx": {
            "type": [
              "number",
              "null"
            ]
          },
          "errors_5xx": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "url_hash",
          "canonical_url",
          "display_path",
          "folder",
          "resource_class",
          "crawl",
          "referrals",
          "citations",
          "findings",
          "key_events",
          "last_crawl",
          "errors_4xx",
          "errors_5xx"
        ],
        "additionalProperties": false
      }
    },
    "next_cursor": {
      "type": [
        "string",
        "null"
      ]
    },
    "observed_crawl_coverage": {
      "type": "object",
      "properties": {
        "state": {
          "type": "string"
        },
        "share": {
          "type": [
            "number",
            "null"
          ]
        },
        "known_pages": {
          "type": "number"
        },
        "observed_pages": {
          "type": [
            "number",
            "null"
          ]
        },
        "inventory_date": {
          "type": [
            "string",
            "null"
          ]
        },
        "inventory_complete": {
          "type": "boolean"
        },
        "sample_mode": {
          "type": "boolean"
        },
        "label": {
          "type": "string",
          "const": "Observed crawl coverage"
        }
      },
      "required": [
        "state",
        "share",
        "known_pages",
        "observed_pages",
        "inventory_date",
        "inventory_complete",
        "sample_mode",
        "label"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "window_start",
    "window_end",
    "items",
    "next_cursor",
    "observed_crawl_coverage"
  ],
  "additionalProperties": false,
  "$defs": {
    "TrafficLeg": {
      "type": "object",
      "properties": {
        "state": {
          "type": "string",
          "enum": [
            "not_connected",
            "unknown",
            "unavailable",
            "zero",
            "value",
            "non_comparable",
            "flagged"
          ]
        },
        "value": {
          "type": [
            "number",
            "null"
          ]
        },
        "coverage": {
          "type": [
            "string",
            "null"
          ]
        },
        "reason": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "state",
        "value",
        "coverage",
        "reason"
      ],
      "additionalProperties": false
    }
  }
}