{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sku.md/schema/sku-md/0.10/schema.json",
  "title": "SKU Markdown Specification v0.10-draft publisher schema",
  "description": "Strict publisher schema for SKU-MD YAML frontmatter. Consumers should parse unknown fields tolerantly but must handle transaction-relevant unknown values conservatively. Validators MUST enable JSON Schema 2020-12 format assertion or perform equivalent URI/date/date-time validation.",
  "oneOf": [
    {
      "$ref": "#/$defs/catalogManifest"
    },
    {
      "$ref": "#/$defs/partitionIndex"
    },
    {
      "$ref": "#/$defs/productDocument"
    }
  ],
  "$defs": {
    "httpsUri": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
    },
    "languageTag": {
      "type": "string",
      "pattern": "^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$",
      "description": "Basic SKU-MD language-tag syntax filter. Publisher validators MUST perform full BCP 47 validation or explicitly document a supported subset."
    },
    "countryCode": {
      "type": "string",
      "pattern": "^[A-Z]{2}$"
    },
    "currencyCode": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
    },
    "functionName": {
      "type": "string",
      "enum": [
        "catalog_lookup",
        "cart",
        "checkout",
        "order_status",
        "product_feed",
        "browser_tools"
      ]
    },
    "generator": {
      "type": "object",
      "required": [
        "name",
        "version"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": "string",
          "minLength": 1
        },
        "url": {
          "$ref": "#/$defs/httpsUri"
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "merchant": {
      "type": "object",
      "required": [
        "name",
        "site_url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "minLength": 1
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "legal_name": {
          "type": "string",
          "minLength": 1
        },
        "site_url": {
          "$ref": "#/$defs/httpsUri"
        },
        "organization_url": {
          "$ref": "#/$defs/httpsUri"
        },
        "support_url": {
          "$ref": "#/$defs/httpsUri"
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "usagePreferences": {
      "type": "object",
      "properties": {
        "model_training": {
          "type": "string",
          "enum": [
            "allow",
            "disallow",
            "unspecified"
          ]
        },
        "retrieval": {
          "type": "string",
          "enum": [
            "allow",
            "disallow",
            "unspecified"
          ]
        },
        "citation": {
          "type": "string",
          "enum": [
            "requested",
            "optional",
            "unspecified"
          ]
        },
        "policy_url": {
          "$ref": "#/$defs/httpsUri"
        }
      },
      "minProperties": 1,
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "authorityReference": {
      "type": "object",
      "required": [
        "source"
      ],
      "properties": {
        "source": {
          "type": "string",
          "enum": [
            "sku_document",
            "capability",
            "protocol_profile",
            "storefront",
            "checkout",
            "external",
            "unavailable"
          ]
        },
        "function": {
          "$ref": "#/$defs/functionName"
        },
        "capability_id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]*$"
        },
        "profile_id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]*$"
        },
        "url": {
          "$ref": "#/$defs/httpsUri"
        },
        "fallback": {
          "type": "string",
          "enum": [
            "sku_document",
            "storefront",
            "checkout",
            "unavailable"
          ]
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "source": {
                "const": "capability"
              }
            },
            "required": [
              "source"
            ]
          },
          "then": {
            "required": [
              "function",
              "capability_id"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "source": {
                "const": "protocol_profile"
              }
            },
            "required": [
              "source"
            ]
          },
          "then": {
            "required": [
              "function",
              "profile_id"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "source": {
                "const": "external"
              }
            },
            "required": [
              "source"
            ]
          },
          "then": {
            "required": [
              "url"
            ]
          }
        }
      ],
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "knowledgeAuthority": {
      "allOf": [
        {
          "$ref": "#/$defs/authorityReference"
        },
        {
          "properties": {
            "source": {
              "enum": [
                "sku_document",
                "storefront",
                "external",
                "unavailable"
              ]
            },
            "fallback": {
              "enum": [
                "sku_document",
                "storefront",
                "unavailable"
              ]
            }
          }
        }
      ]
    },
    "snapshotAuthority": {
      "allOf": [
        {
          "$ref": "#/$defs/authorityReference"
        },
        {
          "properties": {
            "source": {
              "enum": [
                "sku_document",
                "storefront",
                "unavailable"
              ]
            },
            "fallback": {
              "enum": [
                "sku_document",
                "storefront",
                "unavailable"
              ]
            }
          }
        }
      ]
    },
    "liveCatalogAuthority": {
      "allOf": [
        {
          "$ref": "#/$defs/authorityReference"
        },
        {
          "properties": {
            "fallback": {
              "enum": [
                "storefront",
                "checkout",
                "unavailable"
              ]
            }
          },
          "oneOf": [
            {
              "properties": {
                "source": {
                  "enum": [
                    "capability",
                    "protocol_profile"
                  ]
                },
                "function": {
                  "enum": [
                    "catalog_lookup",
                    "checkout"
                  ]
                }
              },
              "required": [
                "source",
                "function"
              ]
            },
            {
              "properties": {
                "source": {
                  "enum": [
                    "storefront",
                    "checkout",
                    "unavailable"
                  ]
                }
              },
              "required": [
                "source"
              ]
            }
          ]
        }
      ]
    },
    "checkoutAuthority": {
      "allOf": [
        {
          "$ref": "#/$defs/authorityReference"
        },
        {
          "properties": {
            "fallback": {
              "enum": [
                "checkout",
                "unavailable"
              ]
            }
          },
          "oneOf": [
            {
              "properties": {
                "source": {
                  "enum": [
                    "capability",
                    "protocol_profile"
                  ]
                },
                "function": {
                  "const": "checkout"
                }
              },
              "required": [
                "source",
                "function"
              ]
            },
            {
              "properties": {
                "source": {
                  "enum": [
                    "checkout",
                    "unavailable"
                  ]
                }
              },
              "required": [
                "source"
              ]
            }
          ]
        }
      ]
    },
    "authorityComplete": {
      "type": "object",
      "required": [
        "identity",
        "product_facts",
        "offer_snapshot",
        "live_price",
        "live_availability",
        "shipping_quote",
        "tax",
        "final_total",
        "payment"
      ],
      "properties": {
        "identity": {
          "$ref": "#/$defs/knowledgeAuthority"
        },
        "product_facts": {
          "$ref": "#/$defs/knowledgeAuthority"
        },
        "offer_snapshot": {
          "$ref": "#/$defs/snapshotAuthority"
        },
        "live_price": {
          "$ref": "#/$defs/liveCatalogAuthority"
        },
        "live_availability": {
          "$ref": "#/$defs/liveCatalogAuthority"
        },
        "shipping_quote": {
          "$ref": "#/$defs/checkoutAuthority"
        },
        "tax": {
          "$ref": "#/$defs/checkoutAuthority"
        },
        "final_total": {
          "$ref": "#/$defs/checkoutAuthority"
        },
        "payment": {
          "$ref": "#/$defs/checkoutAuthority"
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "authorityOverrides": {
      "type": "object",
      "properties": {
        "identity": {
          "$ref": "#/$defs/knowledgeAuthority"
        },
        "product_facts": {
          "$ref": "#/$defs/knowledgeAuthority"
        },
        "offer_snapshot": {
          "$ref": "#/$defs/snapshotAuthority"
        },
        "live_price": {
          "$ref": "#/$defs/liveCatalogAuthority"
        },
        "live_availability": {
          "$ref": "#/$defs/liveCatalogAuthority"
        },
        "shipping_quote": {
          "$ref": "#/$defs/checkoutAuthority"
        },
        "tax": {
          "$ref": "#/$defs/checkoutAuthority"
        },
        "final_total": {
          "$ref": "#/$defs/checkoutAuthority"
        },
        "payment": {
          "$ref": "#/$defs/checkoutAuthority"
        }
      },
      "minProperties": 1,
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "capabilityDiscovery": {
      "type": "object",
      "required": [
        "mode"
      ],
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "well_known",
            "directory",
            "document",
            "page_runtime"
          ]
        },
        "url": {
          "$ref": "#/$defs/httpsUri"
        },
        "scope": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "enum": [
              "product",
              "cart",
              "checkout",
              "order"
            ]
          }
        },
        "page_url_patterns": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^https://"
          }
        },
        "requires_user_presence": {
          "type": "boolean"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "mode": {
                "const": "page_runtime"
              }
            },
            "required": [
              "mode"
            ]
          },
          "then": {
            "required": [
              "scope",
              "page_url_patterns",
              "requires_user_presence"
            ],
            "properties": {
              "requires_user_presence": {
                "const": true
              }
            },
            "not": {
              "required": [
                "url"
              ]
            }
          },
          "else": {
            "required": [
              "url"
            ],
            "not": {
              "anyOf": [
                {
                  "required": [
                    "page_url_patterns"
                  ]
                },
                {
                  "required": [
                    "requires_user_presence"
                  ]
                }
              ]
            }
          }
        }
      ],
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "capabilityAccess": {
      "type": "object",
      "required": [
        "mode",
        "authentication"
      ],
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "public",
            "authenticated",
            "platform_approval",
            "partner_only",
            "page_runtime"
          ]
        },
        "authentication": {
          "type": "string",
          "enum": [
            "none",
            "protocol_defined",
            "oauth2",
            "api_key",
            "other"
          ]
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "mode": {
                "const": "public"
              }
            },
            "required": [
              "mode"
            ]
          },
          "then": {
            "properties": {
              "authentication": {
                "const": "none"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "mode": {
                "const": "authenticated"
              }
            },
            "required": [
              "mode"
            ]
          },
          "then": {
            "properties": {
              "authentication": {
                "not": {
                  "const": "none"
                }
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "authentication": {
                "const": "none"
              }
            },
            "required": [
              "authentication"
            ]
          },
          "then": {
            "properties": {
              "mode": {
                "enum": [
                  "public",
                  "page_runtime"
                ]
              }
            }
          }
        }
      ],
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "capability": {
      "type": "object",
      "required": [
        "id",
        "function",
        "protocol",
        "status",
        "discovery",
        "access"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]*$"
        },
        "function": {
          "$ref": "#/$defs/functionName"
        },
        "protocol": {
          "type": "string",
          "minLength": 1
        },
        "capability": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "type": "string",
          "enum": [
            "live",
            "beta",
            "planned",
            "deprecated",
            "disabled"
          ]
        },
        "discovery": {
          "$ref": "#/$defs/capabilityDiscovery"
        },
        "access": {
          "$ref": "#/$defs/capabilityAccess"
        },
        "note": {
          "type": "string",
          "minLength": 1
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "discovery": {
                "type": "object",
                "properties": {
                  "mode": {
                    "const": "page_runtime"
                  }
                },
                "required": [
                  "mode"
                ]
              }
            },
            "required": [
              "discovery"
            ]
          },
          "then": {
            "properties": {
              "access": {
                "type": "object",
                "properties": {
                  "mode": {
                    "const": "page_runtime"
                  },
                  "authentication": {
                    "const": "none"
                  }
                }
              }
            }
          }
        }
      ],
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "protocolProfile": {
      "type": "object",
      "required": [
        "id",
        "protocol",
        "url",
        "status"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]*$"
        },
        "protocol": {
          "type": "string",
          "minLength": 1
        },
        "url": {
          "$ref": "#/$defs/httpsUri"
        },
        "status": {
          "type": "string",
          "enum": [
            "live",
            "beta",
            "planned",
            "deprecated",
            "disabled"
          ]
        },
        "note": {
          "type": "string",
          "minLength": 1
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "identifiers": {
      "type": "object",
      "properties": {
        "product_id_prefix": {
          "type": "string",
          "minLength": 1
        },
        "variant_id_prefix": {
          "type": "string",
          "minLength": 1
        },
        "sku_scope": {
          "type": "string",
          "enum": [
            "merchant",
            "global"
          ]
        },
        "checkout_key": {
          "type": "string",
          "enum": [
            "variant_id",
            "sku",
            "gtin"
          ]
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "catalogEntrypoint": {
      "type": "object",
      "required": [
        "type",
        "format",
        "url"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "product_index",
            "product_documents",
            "partition",
            "storefront_catalog"
          ]
        },
        "format": {
          "type": "string",
          "enum": [
            "markdown",
            "json",
            "jsonl",
            "xml",
            "sitemap",
            "html"
          ]
        },
        "url": {
          "$ref": "#/$defs/httpsUri"
        },
        "media_type": {
          "type": "string",
          "pattern": "^[a-z0-9!#$&^_.+-]+/[a-z0-9!#$&^_.+-]+$"
        },
        "content_language": {
          "$ref": "#/$defs/languageTag"
        },
        "market": {
          "$ref": "#/$defs/countryCode"
        },
        "last_updated": {
          "type": "string",
          "format": "date-time"
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "catalog": {
      "type": "object",
      "required": [
        "mode",
        "entrypoints"
      ],
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "discovery",
            "indexed"
          ]
        },
        "product_count": {
          "type": "integer",
          "minimum": 0
        },
        "variant_count": {
          "type": "integer",
          "minimum": 0
        },
        "entrypoints": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/catalogEntrypoint"
          }
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "mode": {
                "const": "indexed"
              }
            },
            "required": [
              "mode"
            ]
          },
          "then": {
            "properties": {
              "entrypoints": {
                "contains": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "enum": [
                        "product_index",
                        "product_documents",
                        "partition"
                      ]
                    }
                  },
                  "required": [
                    "type"
                  ]
                }
              }
            }
          }
        }
      ],
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "policies": {
      "type": "object",
      "properties": {
        "shipping": {
          "$ref": "#/$defs/httpsUri"
        },
        "returns": {
          "$ref": "#/$defs/httpsUri"
        },
        "warranty": {
          "$ref": "#/$defs/httpsUri"
        },
        "privacy": {
          "$ref": "#/$defs/httpsUri"
        },
        "terms": {
          "$ref": "#/$defs/httpsUri"
        }
      },
      "minProperties": 1,
      "patternProperties": {
        "^x_": {
          "$ref": "#/$defs/httpsUri"
        }
      },
      "additionalProperties": false
    },
    "scope": {
      "type": "object",
      "required": [
        "axis",
        "value"
      ],
      "properties": {
        "axis": {
          "type": "string",
          "enum": [
            "category",
            "market",
            "language"
          ]
        },
        "value": {
          "type": "string",
          "minLength": 1
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "market": {
      "type": "object",
      "required": [
        "country",
        "currency"
      ],
      "properties": {
        "country": {
          "$ref": "#/$defs/countryCode"
        },
        "currency": {
          "$ref": "#/$defs/currencyCode"
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "productAttribute": {
      "type": "object",
      "required": [
        "name",
        "value"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "value": {
          "type": [
            "string",
            "number",
            "boolean"
          ]
        },
        "unit": {
          "type": "string",
          "minLength": 1
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "product": {
      "type": "object",
      "required": [
        "id",
        "title",
        "link"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "item_group_id": {
          "type": "string",
          "minLength": 1
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "link": {
          "$ref": "#/$defs/httpsUri"
        },
        "attributes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/productAttribute"
          }
        },
        "brand": {
          "type": "string",
          "minLength": 1
        },
        "description": {
          "type": "string",
          "minLength": 1
        },
        "media": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "$ref": "#/$defs/imageMedia"
              },
              {
                "$ref": "#/$defs/videoMedia"
              }
            ]
          }
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "option": {
      "type": "object",
      "required": [
        "name",
        "value"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "value": {
          "type": "string",
          "minLength": 1
        },
        "normalized": {
          "type": "string",
          "minLength": 1
        },
        "system": {
          "type": "string",
          "minLength": 1
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "imageMedia": {
      "type": "object",
      "required": [
        "type",
        "url",
        "alt"
      ],
      "properties": {
        "type": {
          "const": "image"
        },
        "url": {
          "$ref": "#/$defs/httpsUri"
        },
        "role": {
          "type": "string",
          "minLength": 1
        },
        "alt": {
          "type": "string",
          "minLength": 1
        },
        "width": {
          "type": "integer",
          "minimum": 1
        },
        "height": {
          "type": "integer",
          "minimum": 1
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "videoMedia": {
      "type": "object",
      "required": [
        "type",
        "url",
        "title"
      ],
      "properties": {
        "type": {
          "const": "video"
        },
        "url": {
          "$ref": "#/$defs/httpsUri"
        },
        "role": {
          "type": "string",
          "minLength": 1
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "caption": {
          "type": "string",
          "minLength": 1
        },
        "transcript_url": {
          "$ref": "#/$defs/httpsUri"
        },
        "thumbnail_url": {
          "$ref": "#/$defs/httpsUri"
        },
        "width": {
          "type": "integer",
          "minimum": 1
        },
        "height": {
          "type": "integer",
          "minimum": 1
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "price": {
      "type": "object",
      "required": [
        "amount",
        "currency",
        "tax_status"
      ],
      "properties": {
        "amount": {
          "type": "integer",
          "minimum": 0,
          "description": "Amount in the currency's minor unit."
        },
        "currency": {
          "$ref": "#/$defs/currencyCode"
        },
        "tax_status": {
          "type": "string",
          "enum": [
            "included",
            "excluded",
            "location_dependent",
            "not_applicable",
            "unknown"
          ]
        },
        "compare_at_amount": {
          "type": "integer",
          "minimum": 0
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "lookupIdentifier": {
      "type": "object",
      "required": [
        "type",
        "value"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "variant_id",
            "sku",
            "gtin"
          ]
        },
        "value": {
          "type": "string",
          "minLength": 1
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "liveLookup": {
      "type": "object",
      "required": [
        "source",
        "function",
        "identifier"
      ],
      "properties": {
        "source": {
          "type": "string",
          "enum": [
            "capability",
            "protocol_profile"
          ]
        },
        "function": {
          "type": "string",
          "enum": [
            "catalog_lookup",
            "checkout"
          ]
        },
        "capability_id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]*$"
        },
        "profile_id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]*$"
        },
        "identifier": {
          "$ref": "#/$defs/lookupIdentifier"
        },
        "note": {
          "type": "string",
          "minLength": 1
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "source": {
                "const": "capability"
              }
            },
            "required": [
              "source"
            ]
          },
          "then": {
            "required": [
              "capability_id"
            ],
            "not": {
              "required": [
                "profile_id"
              ]
            }
          }
        },
        {
          "if": {
            "properties": {
              "source": {
                "const": "protocol_profile"
              }
            },
            "required": [
              "source"
            ]
          },
          "then": {
            "required": [
              "profile_id"
            ],
            "not": {
              "required": [
                "capability_id"
              ]
            }
          }
        }
      ],
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "offerSnapshot": {
      "type": "object",
      "required": [
        "market",
        "price",
        "availability",
        "observed_at",
        "authority"
      ],
      "properties": {
        "market": {
          "$ref": "#/$defs/countryCode"
        },
        "price": {
          "$ref": "#/$defs/price"
        },
        "availability": {
          "type": "string",
          "enum": [
            "in_stock",
            "out_of_stock",
            "preorder",
            "backorder",
            "discontinued",
            "unknown"
          ]
        },
        "inventory_signal": {
          "type": "string",
          "enum": [
            "normal",
            "low",
            "unknown"
          ]
        },
        "availability_date": {
          "type": "string",
          "format": "date"
        },
        "observed_at": {
          "type": "string",
          "format": "date-time"
        },
        "refresh_after": {
          "type": "string",
          "format": "date-time"
        },
        "offer_valid_until": {
          "type": "string",
          "format": "date-time"
        },
        "authority": {
          "const": "snapshot"
        },
        "live_lookup": {
          "$ref": "#/$defs/liveLookup"
        },
        "live_verification": {
          "$ref": "#/$defs/liveVerification"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "availability": {
                "const": "preorder"
              }
            },
            "required": [
              "availability"
            ]
          },
          "then": {
            "required": [
              "availability_date"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "inventory_signal": {
                "const": "low"
              }
            },
            "required": [
              "inventory_signal"
            ]
          },
          "then": {
            "properties": {
              "availability": {
                "const": "in_stock"
              }
            }
          }
        }
      ],
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "liveOffer": {
      "type": "object",
      "required": [
        "market",
        "authority",
        "lookup"
      ],
      "properties": {
        "market": {
          "$ref": "#/$defs/countryCode"
        },
        "authority": {
          "const": "live_lookup"
        },
        "lookup": {
          "$ref": "#/$defs/liveLookup"
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "variant": {
      "type": "object",
      "required": [
        "id",
        "sku",
        "title",
        "link"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "sku": {
          "type": "string",
          "minLength": 1
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "link": {
          "$ref": "#/$defs/httpsUri"
        },
        "gtin": {
          "type": "string",
          "pattern": "^(?:[0-9]{8}|[0-9]{12}|[0-9]{13}|[0-9]{14})$",
          "description": "GTIN-8, GTIN-12, GTIN-13 or GTIN-14. Publisher validators SHOULD also verify the GS1 check digit."
        },
        "mpn": {
          "type": "string",
          "minLength": 1
        },
        "brand": {
          "type": "string",
          "minLength": 1
        },
        "condition": {
          "type": "string",
          "enum": [
            "new",
            "used",
            "refurbished"
          ]
        },
        "options": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/option"
          }
        },
        "media": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "$ref": "#/$defs/imageMedia"
              },
              {
                "$ref": "#/$defs/videoMedia"
              }
            ]
          }
        },
        "offer_snapshot": {
          "$ref": "#/$defs/offerSnapshot"
        },
        "live_offer": {
          "$ref": "#/$defs/liveOffer"
        }
      },
      "not": {
        "required": [
          "offer_snapshot",
          "live_offer"
        ]
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "fact": {
      "type": "object",
      "required": [
        "id",
        "statement",
        "source_url",
        "verified_at"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]*$"
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "source_url": {
          "$ref": "#/$defs/httpsUri"
        },
        "verified_at": {
          "type": "string",
          "format": "date"
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "claim": {
      "type": "object",
      "required": [
        "id",
        "statement",
        "asserted_by"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]*$"
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "asserted_by": {
          "type": "string",
          "enum": [
            "manufacturer",
            "merchant",
            "third_party"
          ]
        },
        "evidence_url": {
          "$ref": "#/$defs/httpsUri"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "asserted_by": {
                "const": "third_party"
              }
            },
            "required": [
              "asserted_by"
            ]
          },
          "then": {
            "required": [
              "evidence_url"
            ]
          }
        }
      ],
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "disclosure": {
      "oneOf": [
        {
          "type": "string",
          "minLength": 1
        },
        {
          "type": "object",
          "required": [
            "id",
            "statement",
            "severity"
          ],
          "properties": {
            "id": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9._-]*$"
            },
            "statement": {
              "type": "string",
              "minLength": 1
            },
            "severity": {
              "type": "string",
              "enum": [
                "notice",
                "warning",
                "critical"
              ]
            },
            "applies_to": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "required_before_checkout": {
              "type": "boolean"
            }
          },
          "patternProperties": {
            "^x_": true
          },
          "additionalProperties": false
        }
      ]
    },
    "guidance": {
      "oneOf": [
        {
          "type": "string",
          "minLength": 1
        },
        {
          "type": "object",
          "required": [
            "statement",
            "asserted_by"
          ],
          "properties": {
            "statement": {
              "type": "string",
              "minLength": 1
            },
            "asserted_by": {
              "type": "string",
              "enum": [
                "manufacturer",
                "merchant"
              ]
            },
            "applies_to": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "evidence_url": {
              "$ref": "#/$defs/httpsUri"
            }
          },
          "patternProperties": {
            "^x_": true
          },
          "additionalProperties": false
        }
      ]
    },
    "limitation": {
      "oneOf": [
        {
          "type": "string",
          "minLength": 1
        },
        {
          "type": "object",
          "required": [
            "statement",
            "category",
            "severity"
          ],
          "properties": {
            "statement": {
              "type": "string",
              "minLength": 1
            },
            "category": {
              "type": "string",
              "enum": [
                "environment",
                "compatibility",
                "performance",
                "safety",
                "care",
                "other"
              ]
            },
            "severity": {
              "type": "string",
              "enum": [
                "notice",
                "warning",
                "critical"
              ]
            },
            "evidence_url": {
              "$ref": "#/$defs/httpsUri"
            },
            "applies_to": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          "patternProperties": {
            "^x_": true
          },
          "additionalProperties": false
        }
      ]
    },
    "compatibility": {
      "type": "object",
      "required": [
        "relation",
        "target_product_id"
      ],
      "properties": {
        "relation": {
          "type": "string",
          "enum": [
            "compatible_with",
            "requires",
            "replaces",
            "part_of_bundle_with"
          ]
        },
        "target_product_id": {
          "type": "string",
          "minLength": 1
        },
        "note": {
          "type": "string",
          "minLength": 1
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "knowledge": {
      "type": "object",
      "properties": {
        "facts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/fact"
          }
        },
        "claims": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/claim"
          }
        },
        "disclosures": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/disclosure"
          }
        },
        "guidance": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/guidance"
          }
        },
        "limitations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/limitation"
          }
        },
        "compatibility": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/compatibility"
          }
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false,
      "anyOf": [
        {
          "required": [
            "facts"
          ],
          "properties": {
            "facts": {
              "minItems": 1
            }
          }
        },
        {
          "required": [
            "claims"
          ],
          "properties": {
            "claims": {
              "minItems": 1
            }
          }
        },
        {
          "required": [
            "disclosures"
          ],
          "properties": {
            "disclosures": {
              "minItems": 1
            }
          }
        },
        {
          "required": [
            "guidance"
          ],
          "properties": {
            "guidance": {
              "minItems": 1
            }
          }
        },
        {
          "required": [
            "limitations"
          ],
          "properties": {
            "limitations": {
              "minItems": 1
            }
          }
        },
        {
          "required": [
            "compatibility"
          ],
          "properties": {
            "compatibility": {
              "minItems": 1
            }
          }
        }
      ]
    },
    "policyOverride": {
      "type": "object",
      "required": [
        "mode",
        "policy_url"
      ],
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "replace",
            "supplement"
          ]
        },
        "policy_code": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]*$"
        },
        "policy_url": {
          "$ref": "#/$defs/httpsUri"
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "policiesOverride": {
      "type": "object",
      "properties": {
        "shipping": {
          "$ref": "#/$defs/policyOverride"
        },
        "returns": {
          "$ref": "#/$defs/policyOverride"
        },
        "warranty": {
          "$ref": "#/$defs/policyOverride"
        },
        "privacy": {
          "$ref": "#/$defs/policyOverride"
        },
        "terms": {
          "$ref": "#/$defs/policyOverride"
        }
      },
      "minProperties": 1,
      "patternProperties": {
        "^x_": {
          "$ref": "#/$defs/policyOverride"
        }
      },
      "additionalProperties": false
    },
    "catalogManifest": {
      "type": "object",
      "required": [
        "schema_version",
        "document_type",
        "profile",
        "canonical",
        "merchant",
        "catalog"
      ],
      "properties": {
        "schema_version": {
          "const": "sku.md/0.10-draft"
        },
        "document_type": {
          "const": "catalog_manifest"
        },
        "profile": {
          "type": "string",
          "enum": [
            "manifest-basic",
            "manifest-commerce"
          ]
        },
        "canonical": {
          "$ref": "#/$defs/httpsUri"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "revision": {
          "type": "string",
          "minLength": 1
        },
        "content_language": {
          "$ref": "#/$defs/languageTag"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time"
        },
        "generator": {
          "$ref": "#/$defs/generator"
        },
        "merchant": {
          "$ref": "#/$defs/merchant"
        },
        "catalog": {
          "$ref": "#/$defs/catalog"
        },
        "usage_preferences": {
          "$ref": "#/$defs/usagePreferences"
        },
        "authority": {
          "$ref": "#/$defs/authorityComplete"
        },
        "capabilities": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/capability"
          }
        },
        "protocol_profiles": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/protocolProfile"
          }
        },
        "identifiers": {
          "$ref": "#/$defs/identifiers"
        },
        "policies": {
          "$ref": "#/$defs/policies"
        },
        "supported_languages": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/languageTag"
          }
        },
        "default_currency": {
          "$ref": "#/$defs/currencyCode"
        },
        "update_frequency": {
          "type": "string",
          "enum": [
            "daily",
            "weekly",
            "on-change"
          ]
        },
        "representations": {
          "$ref": "#/$defs/representations"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "profile": {
                "const": "manifest-commerce"
              }
            },
            "required": [
              "profile"
            ]
          },
          "then": {
            "required": [
              "usage_preferences",
              "authority",
              "identifiers",
              "policies"
            ],
            "anyOf": [
              {
                "required": [
                  "capabilities"
                ]
              },
              {
                "required": [
                  "protocol_profiles"
                ]
              }
            ]
          }
        },
        {
          "if": {
            "properties": {
              "profile": {
                "const": "manifest-basic"
              }
            },
            "required": [
              "profile"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "authority"
                  ]
                },
                {
                  "required": [
                    "capabilities"
                  ]
                },
                {
                  "required": [
                    "protocol_profiles"
                  ]
                },
                {
                  "required": [
                    "identifiers"
                  ]
                }
              ]
            }
          }
        }
      ],
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "partitionIndex": {
      "type": "object",
      "required": [
        "schema_version",
        "document_type",
        "canonical",
        "parent",
        "scope",
        "catalog"
      ],
      "properties": {
        "schema_version": {
          "const": "sku.md/0.10-draft"
        },
        "document_type": {
          "const": "partition_index"
        },
        "canonical": {
          "$ref": "#/$defs/httpsUri"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "revision": {
          "type": "string",
          "minLength": 1
        },
        "content_language": {
          "$ref": "#/$defs/languageTag"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time"
        },
        "generator": {
          "$ref": "#/$defs/generator"
        },
        "parent": {
          "$ref": "#/$defs/httpsUri"
        },
        "scope": {
          "$ref": "#/$defs/scope"
        },
        "catalog": {
          "$ref": "#/$defs/catalog"
        },
        "usage_preferences": {
          "$ref": "#/$defs/usagePreferences"
        },
        "authority": {
          "$ref": "#/$defs/authorityOverrides"
        },
        "capabilities": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/capability"
          }
        },
        "protocol_profiles": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/protocolProfile"
          }
        },
        "policies": {
          "$ref": "#/$defs/policies"
        },
        "representations": {
          "$ref": "#/$defs/representations"
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "productDocument": {
      "type": "object",
      "required": [
        "schema_version",
        "document_type",
        "canonical",
        "content_language",
        "parent",
        "market",
        "product",
        "variants",
        "knowledge"
      ],
      "properties": {
        "schema_version": {
          "const": "sku.md/0.10-draft"
        },
        "document_type": {
          "const": "product_document"
        },
        "canonical": {
          "$ref": "#/$defs/httpsUri"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "revision": {
          "type": "string",
          "minLength": 1
        },
        "content_language": {
          "$ref": "#/$defs/languageTag"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time"
        },
        "generator": {
          "$ref": "#/$defs/generator"
        },
        "parent": {
          "$ref": "#/$defs/httpsUri"
        },
        "market": {
          "$ref": "#/$defs/market"
        },
        "product": {
          "$ref": "#/$defs/product"
        },
        "variants": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/variant"
          }
        },
        "knowledge": {
          "$ref": "#/$defs/knowledge"
        },
        "usage_preferences": {
          "$ref": "#/$defs/usagePreferences"
        },
        "authority": {
          "$ref": "#/$defs/authorityOverrides"
        },
        "capabilities": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/capability"
          }
        },
        "protocol_profiles": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/protocolProfile"
          }
        },
        "policies_override": {
          "$ref": "#/$defs/policiesOverride"
        },
        "representations": {
          "$ref": "#/$defs/representations"
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "representations": {
      "type": "object",
      "properties": {
        "markdown": {
          "$ref": "#/$defs/httpsUri"
        },
        "json": {
          "$ref": "#/$defs/httpsUri"
        }
      },
      "minProperties": 1,
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    },
    "liveVerification": {
      "type": "object",
      "required": [
        "source",
        "url",
        "identifier"
      ],
      "properties": {
        "source": {
          "const": "storefront"
        },
        "url": {
          "$ref": "#/$defs/httpsUri"
        },
        "identifier": {
          "$ref": "#/$defs/lookupIdentifier"
        },
        "note": {
          "type": "string",
          "minLength": 1
        }
      },
      "patternProperties": {
        "^x_": true
      },
      "additionalProperties": false
    }
  }
}
