{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tune.toys/schemas/platform/product-page.schema.json",
  "title": "ProductPage",
  "description": "Visibility-filtered public product listing, documents, versions, offers and head metadata shared by HTML and React.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "kind": {
      "type": "string",
      "enum": ["product", "document", "version"]
    },
    "head": {
      "$ref": "#/$defs/PublicPageHead"
    },
    "publisher": {
      "$ref": "#/$defs/PagePublisher"
    },
    "product": {
      "$ref": "#/$defs/PageProduct"
    },
    "visibility": {
      "type": "string",
      "enum": ["public", "unlisted", "private"]
    },
    "preview": {
      "type": "boolean"
    },
    "tombstone": {
      "type": "boolean"
    },
    "fields": {
      "$ref": "listing-revision.schema.json#/$defs/ListingFields"
    },
    "bodyHtml": {
      "type": "string",
      "maxLength": 1048576
    },
    "controlsNotesHtml": {
      "type": "string",
      "maxLength": 1048576
    },
    "requirementsNotesHtml": {
      "type": "string",
      "maxLength": 1048576
    },
    "gallery": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PageGallery"
      },
      "maxItems": 6
    },
    "trailer": {
      "anyOf": [
        {
          "$ref": "#/$defs/PageGalleryItem"
        },
        {
          "type": "null"
        }
      ]
    },
    "documents": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PageDocument"
      },
      "maxItems": 100
    },
    "versions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PageVersion"
      },
      "maxItems": 1000
    },
    "offers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PageOffer"
      },
      "maxItems": 100
    },
    "release": {
      "anyOf": [
        {
          "$ref": "#/$defs/PageRelease"
        },
        {
          "type": "null"
        }
      ]
    },
    "thumbnail": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048
        },
        {
          "type": "null"
        }
      ]
    },
    "rating": {
      "anyOf": [
        {
          "$ref": "#/$defs/PageRating"
        },
        {
          "type": "null"
        }
      ]
    },
    "included": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PageProductCard"
      },
      "maxItems": 100
    },
    "more": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PageProductCard"
      },
      "maxItems": 4
    },
    "document": {
      "anyOf": [
        {
          "$ref": "#/$defs/PageDocument"
        },
        {
          "type": "null"
        }
      ]
    },
    "version": {
      "anyOf": [
        {
          "$ref": "#/$defs/PageVersion"
        },
        {
          "type": "null"
        }
      ]
    },
    "machineTranslation": {
      "type": "boolean"
    }
  },
  "required": [
    "kind",
    "head",
    "publisher",
    "product",
    "visibility",
    "preview",
    "tombstone",
    "fields",
    "bodyHtml",
    "controlsNotesHtml",
    "requirementsNotesHtml",
    "gallery",
    "trailer",
    "documents",
    "versions",
    "offers",
    "release",
    "thumbnail",
    "rating",
    "included",
    "more",
    "document",
    "version",
    "machineTranslation"
  ],
  "$defs": {
    "PublicPageHead": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "title": {
          "type": "string",
          "maxLength": 300
        },
        "description": {
          "type": "string",
          "maxLength": 1000
        },
        "path": {
          "type": "string",
          "maxLength": 2048
        },
        "image": {
          "type": "string",
          "maxLength": 2048
        },
        "index": {
          "type": "boolean"
        }
      },
      "required": ["title", "description", "path", "image", "index"],
      "title": "PublicPageHead"
    },
    "PagePublisher": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 128
        },
        "handle": {
          "type": "string",
          "maxLength": 64
        },
        "displayName": {
          "type": "string",
          "maxLength": 200
        }
      },
      "required": ["id", "handle", "displayName"],
      "title": "PagePublisher"
    },
    "PageProduct": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 128
        },
        "slug": {
          "type": "string",
          "maxLength": 128
        },
        "kind": {
          "$ref": "enums.schema.json#/$defs/ProductKind"
        },
        "state": {
          "$ref": "enums.schema.json#/$defs/ProductState"
        },
        "stableVersionId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 128
            },
            {
              "type": "null"
            }
          ]
        },
        "betaVersionId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 128
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "slug",
        "kind",
        "state",
        "stableVersionId",
        "betaVersionId"
      ],
      "title": "PageProduct"
    },
    "PageRating": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "average": {
          "type": "number",
          "minimum": 0,
          "maximum": 5
        },
        "count": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": ["average", "count"],
      "title": "PageRating"
    },
    "PageProductCard": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 128
        },
        "kind": {
          "$ref": "enums.schema.json#/$defs/ProductKind"
        },
        "title": {
          "type": "string",
          "maxLength": 200
        },
        "tagline": {
          "type": "string",
          "maxLength": 500
        },
        "category": {
          "type": "string",
          "maxLength": 48
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 32
          },
          "maxItems": 12
        },
        "url": {
          "type": "string",
          "maxLength": 2048
        },
        "image": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048
            },
            {
              "type": "null"
            }
          ]
        },
        "rating": {
          "anyOf": [
            {
              "$ref": "#/$defs/PageRating"
            },
            {
              "type": "null"
            }
          ]
        },
        "updatedAt": {
          "type": "string",
          "maxLength": 64
        },
        "release": {
          "anyOf": [
            {
              "$ref": "#/$defs/PageRelease"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "kind",
        "title",
        "tagline",
        "category",
        "tags",
        "url",
        "image",
        "rating",
        "updatedAt",
        "release"
      ],
      "title": "PageProductCard"
    },
    "PageGalleryItem": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 128
        },
        "kind": {
          "type": "string",
          "enum": ["image", "gif", "video", "audio", "youtube", "vimeo"]
        },
        "alt": {
          "type": "string",
          "maxLength": 500
        },
        "caption": {
          "type": "string",
          "maxLength": 2000
        },
        "transcript": {
          "type": "string",
          "maxLength": 20000
        },
        "src": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048
            },
            {
              "type": "null"
            }
          ]
        },
        "poster": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048
            },
            {
              "type": "null"
            }
          ]
        },
        "videoId": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 64
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "kind",
        "alt",
        "caption",
        "transcript",
        "src",
        "poster",
        "videoId"
      ],
      "title": "PageGalleryItem"
    },
    "PageGallery": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "key": {
          "type": "string",
          "maxLength": 64
        },
        "title": {
          "type": "string",
          "maxLength": 200
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PageGalleryItem"
          },
          "maxItems": 40
        }
      },
      "required": ["key", "title", "items"],
      "title": "PageGallery"
    },
    "PageVersionTarget": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "targetProfile": {
          "$ref": "enums.schema.json#/$defs/TargetProfile"
        },
        "included": {
          "type": "boolean"
        },
        "supported": {
          "type": "boolean"
        },
        "tested": {
          "type": "boolean"
        },
        "notes": {
          "type": "string",
          "maxLength": 4000
        }
      },
      "required": ["targetProfile", "included", "supported", "tested", "notes"],
      "title": "PageVersionTarget"
    },
    "PageVersion": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 128
        },
        "semver": {
          "type": "string",
          "maxLength": 64
        },
        "state": {
          "$ref": "enums.schema.json#/$defs/ProductVersionState"
        },
        "publishedAt": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 64
            },
            {
              "type": "null"
            }
          ]
        },
        "yankReason": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2000
            },
            {
              "type": "null"
            }
          ]
        },
        "changelogHtml": {
          "type": "string",
          "maxLength": 1048576
        },
        "targets": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PageVersionTarget"
          },
          "maxItems": 32
        }
      },
      "required": [
        "id",
        "semver",
        "state",
        "publishedAt",
        "yankReason",
        "changelogHtml",
        "targets"
      ],
      "title": "PageVersion"
    },
    "PageDocument": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 128
        },
        "slug": {
          "type": "string",
          "maxLength": 128
        },
        "title": {
          "type": "string",
          "maxLength": 200
        },
        "kind": {
          "$ref": "enums.schema.json#/$defs/ListingDocumentKind"
        },
        "locale": {
          "type": "string",
          "maxLength": 20
        },
        "bodyHtml": {
          "type": "string",
          "maxLength": 1048576
        },
        "pdf": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2048
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": ["id", "slug", "title", "kind", "locale", "bodyHtml", "pdf"],
      "title": "PageDocument"
    },
    "PageOffer": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 128
        },
        "title": {
          "type": "string",
          "maxLength": 200
        },
        "kind": {
          "type": "string",
          "enum": ["free", "payment", "subscription"]
        },
        "currency": {
          "type": "string",
          "enum": ["usd"]
        },
        "amount": {
          "type": "integer",
          "minimum": 0
        },
        "interval": {
          "type": ["string", "null"],
          "enum": ["month", "year", null]
        }
      },
      "required": ["id", "title", "kind", "currency", "amount", "interval"],
      "title": "PageOffer"
    },
    "PageRelease": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "projectId": {
          "type": "string",
          "maxLength": 128
        },
        "digest": {
          "type": "string",
          "maxLength": 128
        }
      },
      "required": ["projectId", "digest"],
      "title": "PageRelease"
    }
  }
}
