{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.ironscout.ai/ids/schemas/market_snapshot_index_v1.schema.json",
  "title": "market_snapshot_index_v1",
  "description": "IDS v1 schema for the static snapshot index at /market-snapshots/{windowDays}d/index.json. Enumerates which caliber artifacts are currently published, with content-integrity hashes. As with market_snapshot_artifact_v1, the IDS schema NAME (market_snapshot_index_v1) and the emitted schemaVersion VALUE (market-snapshot-index/v1) differ by historical accident; convergence is tracked in /ids/changelog.md.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "windowDays",
    "generatedAt",
    "sourceApiEndpoint",
    "coverage",
    "methodology",
    "artifacts"
  ],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "market-snapshot-index/v1"
    },
    "windowDays": { "type": "integer", "minimum": 1 },
    "generatedAt": { "type": "string", "format": "date-time" },
    "sourceApiEndpoint": {
      "type": "string",
      "description": "Source endpoint the artifacts were generated from. May be a URL or a fixture:// reference for test builds."
    },
    "coverage": {
      "type": "object",
      "additionalProperties": false,
      "required": ["routedCaliberCount", "apiCaliberCount", "policy"],
      "properties": {
        "routedCaliberCount": { "type": "integer", "minimum": 0 },
        "apiCaliberCount": { "type": "integer", "minimum": 0 },
        "policy": { "type": "string", "enum": ["site_routed_only"] }
      }
    },
    "methodology": {
      "type": "object",
      "additionalProperties": false,
      "required": ["notes"],
      "properties": {
        "notes": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    },
    "artifacts": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "caliberSlug",
          "artifactUrl",
          "artifactSha256",
          "dataStatus",
          "sampleCount",
          "computedAt"
        ],
        "properties": {
          "caliberSlug": { "type": "string" },
          "artifactUrl": { "type": "string" },
          "artifactSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Hex sha256 of the artifact JSON for content-integrity verification."
          },
          "dataStatus": {
            "type": "string",
            "enum": ["SUFFICIENT", "INSUFFICIENT_DATA", "UNAVAILABLE"]
          },
          "sampleCount": { "type": "integer", "minimum": 0 },
          "computedAt": { "type": ["string", "null"], "format": "date-time" }
        }
      }
    }
  }
}
