{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://broadsidecode.com/schemas/products.v1.json",
  "title": "Broadside Code product catalog",
  "type": "object",
  "required": [
    "schema_version",
    "brand",
    "currency",
    "products"
  ],
  "properties": {
    "schema_version": {
      "const": "1.3"
    },
    "categories": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "name",
          "url",
          "count"
        ]
      }
    },
    "products": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "description",
          "status",
          "type",
          "category",
          "version",
          "price",
          "currency",
          "purchase_url",
          "checkout_enabled",
          "url",
          "license",
          "delivery"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable product id. Also the URL slug, sku and the key used everywhere. Never changes."
          },
          "sku": {
            "type": "string",
            "description": "Same as id."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "description": {
            "type": "string",
            "description": "One paragraph summary."
          },
          "status": {
            "enum": [
              "available",
              "coming_soon",
              "retired"
            ],
            "description": "Product readiness; checkout_enabled separately controls purchasing."
          },
          "type": {
            "enum": [
              "playbook",
              "prompt_pack",
              "loop_pack",
              "bundle"
            ]
          },
          "category": {
            "enum": [
              "playbooks",
              "prompt-packs",
              "loop-packs",
              "bundles"
            ],
            "description": "Category id. Category page: /category/<id>."
          },
          "category_url": {
            "type": "string",
            "description": "Category page URL."
          },
          "version": {
            "type": "string",
            "description": "Product content version."
          },
          "added": {
            "type": "string",
            "description": "Date added to the catalog, YYYY-MM-DD."
          },
          "price": {
            "type": "number",
            "description": "Effective fixed price in major units of currency (36 means 36.00 USD)."
          },
          "regular_price": {
            "type": "number",
            "description": "Regular price before any fixed launch price."
          },
          "price_display": {
            "type": "string",
            "description": "Formatted price, e.g. $45.00."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code."
          },
          "pricing_model": {
            "enum": [
              "one_time"
            ]
          },
          "format": {
            "type": "string",
            "description": "File formats delivered."
          },
          "contents": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "includes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "For bundles: ids of included products."
          },
          "url": {
            "type": "string",
            "description": "Canonical HTML product page."
          },
          "markdown_url": {
            "type": "string",
            "description": "Plain markdown version of the product page."
          },
          "purchase_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Open this URL to buy. null when checkout is disabled or the product is coming soon."
          },
          "payment_link": {
            "type": [
              "string",
              "null"
            ],
            "description": "Deprecated alias of purchase_url."
          },
          "payment_link_mode": {
            "enum": [
              "disabled",
              "test",
              "live"
            ],
            "description": "disabled means checkout is unavailable."
          },
          "checkout_enabled": {
            "type": "boolean"
          },
          "payment_provider": {
            "type": "string",
            "description": "Checkout type."
          },
          "stripe_product_id": {
            "type": "string",
            "description": "Stripe product id."
          },
          "license": {
            "type": "object",
            "properties": {
              "summary": {
                "type": "string"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "refunds": {
            "type": "string",
            "description": "Refund policy."
          },
          "delivery": {
            "type": "object",
            "properties": {
              "method": {
                "enum": [
                  "email_link",
                  "redirect_download",
                  "unconfirmed"
                ]
              },
              "details": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
