{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tune.toys/schemas/platform/storefront-page.schema.json",
  "title": "StorefrontPage",
  "description": "Published or member-preview storefront sections, theme and public product cards.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "head": {
      "$ref": "product-page.schema.json#/$defs/PublicPageHead"
    },
    "publisher": {
      "$ref": "product-page.schema.json#/$defs/PagePublisher"
    },
    "visibility": {
      "type": "string",
      "enum": ["public", "unlisted", "private"]
    },
    "preview": {
      "type": "boolean"
    },
    "theme": {
      "$ref": "storefront-revision.schema.json#/$defs/StorefrontTheme"
    },
    "sections": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PageStorefrontSection"
      },
      "maxItems": 50
    },
    "products": {
      "type": "array",
      "items": {
        "$ref": "product-page.schema.json#/$defs/PageProductCard"
      },
      "maxItems": 1000
    }
  },
  "required": [
    "head",
    "publisher",
    "visibility",
    "preview",
    "theme",
    "sections",
    "products"
  ],
  "$defs": {
    "PageStorefrontSection": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 128
        },
        "type": {
          "type": "string",
          "enum": [
            "hero",
            "featured",
            "product_grid",
            "bundle",
            "collection",
            "markdown",
            "video",
            "links"
          ]
        },
        "title": {
          "type": "string",
          "maxLength": 200
        },
        "subtitle": {
          "type": "string",
          "maxLength": 2000
        },
        "bodyHtml": {
          "type": "string",
          "maxLength": 1048576
        },
        "image": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048
            },
            {
              "type": "null"
            }
          ]
        },
        "alt": {
          "type": "string",
          "maxLength": 500
        },
        "action": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048
            },
            {
              "type": "null"
            }
          ]
        },
        "layout": {
          "type": "string",
          "maxLength": 40
        },
        "productIds": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 128
          },
          "maxItems": 1000
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "product-page.schema.json#/$defs/PageGalleryItem"
          },
          "maxItems": 40
        },
        "links": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "label": {
                "type": "string",
                "maxLength": 200
              },
              "href": {
                "type": "string",
                "maxLength": 2048
              }
            },
            "required": ["label", "href"]
          },
          "maxItems": 30
        }
      },
      "required": [
        "id",
        "type",
        "title",
        "subtitle",
        "bodyHtml",
        "image",
        "alt",
        "action",
        "layout",
        "productIds",
        "items",
        "links"
      ],
      "title": "PageStorefrontSection"
    }
  }
}
