{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/shelfatlas-com/json-schema/shelfatlas-com-stats-schema.json",
  "title": "Stats",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/shelfatlas-com-stats-api-openapi.yml#/components/schemas/Stats",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "liveOffers",
    "storesCount",
    "chainsCovered",
    "productsCount",
    "priceHistoryDays",
    "perChain",
    "recentOffers",
    "generatedAt"
  ],
  "properties": {
    "liveOffers": {
      "type": "integer"
    },
    "storesCount": {
      "type": "integer"
    },
    "chainsCovered": {
      "type": "integer"
    },
    "productsCount": {
      "type": "integer"
    },
    "priceHistoryDays": {
      "type": "integer",
      "description": "Age of the oldest price observation, in days."
    },
    "perChain": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ChainStat"
      }
    },
    "recentOffers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RecentOffer"
      }
    },
    "latestOffersAcrossChains": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RecentOffer"
      },
      "description": "Newest current campaign offers across chains (at most 2 per chain, 6 in total). Optional: absent in payloads cached before it existed."
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Wallclock when this snapshot was assembled."
    }
  },
  "$defs": {
    "ChainStat": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "slug",
        "logoUrl",
        "storeCount",
        "liveOfferCount"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "logoUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "storeCount": {
          "type": "integer"
        },
        "liveOfferCount": {
          "type": "integer"
        }
      }
    },
    "RecentOffer": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "rawName",
        "price",
        "currency",
        "chainName",
        "imageUrl"
      ],
      "properties": {
        "rawName": {
          "type": "string"
        },
        "price": {
          "type": "string",
          "description": "Decimal string (Postgres numeric)."
        },
        "currency": {
          "type": "string",
          "minLength": 3,
          "maxLength": 3
        },
        "chainName": {
          "type": [
            "string",
            "null"
          ]
        },
        "imageUrl": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}