{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.ironscout.ai/ids/schemas/caliber_market_snapshot_list_v1.schema.json",
  "title": "caliber_market_snapshot_list_v1",
  "description": "IDS v1 response shape for GET /api/market-snapshots/calibers — list of current snapshots for one window size. List items are caliber_market_snapshot row data without the envelope fields (schemaVersion, requestId), which live at the response root. See https://www.ironscout.ai/.well-known/ids.md.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "snapshots", "meta"],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "caliber_market_snapshot_list_v1"
    },
    "requestId": {
      "description": "Opaque per-request identifier. May be null when there is no active request context.",
      "type": ["string", "null"]
    },
    "snapshots": {
      "type": "array",
      "description": "Caliber snapshots for the requested window. Same row data as caliber_market_snapshot_v1 minus the envelope (schemaVersion, requestId), which appear once at the response root.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "caliber",
          "windowDays",
          "windowStart",
          "windowEnd",
          "statBasis",
          "statLabel",
          "methodology",
          "methodologyMeta",
          "median",
          "p25",
          "p75",
          "min",
          "max",
          "sampleCount",
          "daysWithData",
          "productCount",
          "retailerCount",
          "computedAt",
          "computationVersion",
          "dataStatus"
        ],
        "properties": {
          "caliber": { "type": "string" },
          "windowDays": { "type": "integer", "minimum": 1 },
          "windowStart": { "type": "string", "format": "date-time" },
          "windowEnd": { "type": "string", "format": "date-time" },
          "statBasis": { "type": "string", "const": "dailyBestObserved" },
          "statLabel": { "type": "string" },
          "methodology": { "type": "string" },
          "methodologyMeta": {
            "type": "object",
            "additionalProperties": false,
            "required": ["methodologyVersion", "computationVersion", "methodologyUrl"],
            "properties": {
              "methodologyVersion": { "type": "string" },
              "computationVersion": { "type": "string" },
              "methodologyUrl": { "type": "string", "format": "uri" }
            }
          },
          "median": { "type": ["number", "null"] },
          "p25": { "type": ["number", "null"] },
          "p75": { "type": ["number", "null"] },
          "p95": {
            "type": ["number", "null"],
            "description": "95th percentile of daily-best price per round — the public '30-day high' (ADR-024 amendment). Additive/optional; null on pre-p95 computationVersions, where consumers fall back to max."
          },
          "min": { "type": ["number", "null"] },
          "max": { "type": ["number", "null"] },
          "sampleCount": { "type": "integer", "minimum": 0 },
          "daysWithData": { "type": "integer", "minimum": 0 },
          "productCount": { "type": "integer", "minimum": 0 },
          "retailerCount": { "type": "integer", "minimum": 0 },
          "computedAt": { "type": "string", "format": "date-time" },
          "computationVersion": { "type": "string" },
          "dataStatus": { "type": "string", "enum": ["SUFFICIENT", "INSUFFICIENT_DATA", "UNAVAILABLE"] },
          "segments": {
            "type": "object",
            "additionalProperties": false,
            "required": ["range", "premium"],
            "description": "Range/practice vs premium/defensive split (ADR-024 amendment, Option B).",
            "properties": {
              "range": { "$ref": "#/$defs/segment" },
              "premium": { "$ref": "#/$defs/segment" }
            }
          }
        }
      }
    },
    "meta": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "windowDays",
        "statBasis",
        "computedAt",
        "calibersWithData",
        "totalCalibers"
      ],
      "properties": {
        "windowDays": { "type": "integer", "minimum": 1 },
        "statBasis": { "type": "string", "const": "dailyBestObserved" },
        "computedAt": {
          "type": ["string", "null"],
          "format": "date-time",
          "description": "Newest computedAt across all snapshots in the list. Null when the list is empty."
        },
        "calibersWithData": { "type": "integer", "minimum": 0 },
        "totalCalibers": { "type": "integer", "minimum": 0 }
      }
    }
  },
  "$defs": {
    "segment": {
      "type": "object",
      "additionalProperties": false,
      "required": ["median", "p25", "p75", "min", "max", "sampleCount"],
      "properties": {
        "median": { "type": ["number", "null"] },
        "p25": { "type": ["number", "null"] },
        "p75": { "type": ["number", "null"] },
        "min": { "type": ["number", "null"] },
        "max": { "type": ["number", "null"] },
        "sampleCount": { "type": "integer", "minimum": 0 }
      }
    }
  }
}
