{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Creative DTC editorial catalog",
  "type": "object",
  "required": [
    "version",
    "revision",
    "count",
    "freshness",
    "products"
  ],
  "properties": {
    "version": {
      "const": "4.1.0"
    },
    "revision": {
      "type": "string",
      "pattern": "^[0-9a-f]{16}$"
    },
    "count": {
      "type": "integer",
      "minimum": 1
    },
    "freshness": {
      "type": "object",
      "required": [
        "kind",
        "catalog_date",
        "update_schedule",
        "live_inventory"
      ],
      "properties": {
        "kind": {
          "const": "editorial_snapshot"
        },
        "catalog_date": {
          "type": "string",
          "format": "date"
        },
        "update_schedule": {
          "const": "manual"
        },
        "live_inventory": {
          "const": false
        }
      }
    },
    "products": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/product"
      }
    },
    "verified_on": {
      "type": "string",
      "format": "date",
      "description": "Legacy snapshot date, not independent verification of every claim. Use per-source checked_at."
    }
  },
  "$defs": {
    "product": {
      "type": "object",
      "required": [
        "id",
        "slug",
        "name",
        "brand",
        "category",
        "form",
        "tldr",
        "tags",
        "availability",
        "price",
        "catalog_date",
        "sources",
        "unknown_fields",
        "url",
        "credit_page",
        "hook",
        "img",
        "claim_status"
      ],
      "properties": {
        "id": {
          "type": "integer",
          "minimum": 1
        },
        "slug": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "brand": {
          "type": "string",
          "minLength": 1
        },
        "category": {
          "type": "string"
        },
        "form": {
          "type": "string"
        },
        "tldr": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "string"
          }
        },
        "tags": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "enum": [
              "solid",
              "refill",
              "reuse",
              "compact",
              "concentrate",
              "screen-free",
              "transform",
              "material"
            ]
          }
        },
        "availability": {
          "const": "unknown"
        },
        "price": {
          "type": "null"
        },
        "catalog_date": {
          "type": "string",
          "format": "date"
        },
        "sources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "url",
              "kind",
              "checked_at"
            ],
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "kind": {
                "type": "string"
              },
              "checked_at": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "unknown_fields": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "credit_page": {
          "type": "string",
          "format": "uri"
        },
        "img_src_url": {
          "type": "string",
          "format": "uri"
        },
        "hook": {
          "type": "string",
          "minLength": 1
        },
        "why": {
          "type": "string",
          "minLength": 1
        },
        "gap": {
          "type": "string",
          "minLength": 1
        },
        "img": {
          "type": "string",
          "minLength": 1
        },
        "claim_status": {
          "const": "editorial_summary"
        },
        "editor_rank": {
          "type": "integer",
          "minimum": 1
        }
      }
    }
  }
}
