{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
    },
    "revision": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "objective": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000
    },
    "editorial": {
      "type": "object",
      "properties": {
        "commerce": {
          "type": "object",
          "properties": {
            "shopOrigin": {
              "type": "string",
              "format": "uri",
              "pattern": "^https:.*"
            },
            "targetId": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
            },
            "matches": {
              "maxItems": 200,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "handle": {
                    "type": "string",
                    "maxLength": 200,
                    "pattern": "^[a-z0-9-]+$"
                  },
                  "topics": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 100
                    }
                  }
                },
                "required": [
                  "handle",
                  "topics"
                ],
                "additionalProperties": false
              }
            },
            "subscriptions": {
              "maxItems": 10,
              "type": "array",
              "items": {
                "type": "string",
                "maxLength": 200,
                "pattern": "^[a-z0-9-]+$"
              }
            }
          },
          "required": [
            "shopOrigin",
            "targetId",
            "matches",
            "subscriptions"
          ],
          "additionalProperties": false
        },
        "kind": {
          "type": "string",
          "const": "wordpress-rss"
        },
        "ranking": {
          "type": "string",
          "const": "reader-v1"
        },
        "catalog": {
          "type": "string",
          "const": "wordpress"
        },
        "archive": {
          "maxItems": 300,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 101
              },
              "path": {
                "type": "string",
                "maxLength": 500,
                "pattern": "^\\/[a-zA-Z0-9%/_-]+\\/$"
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "image": {
                "type": "string",
                "format": "uri",
                "pattern": "^https:.*"
              },
              "publishedAt": {
                "type": "number"
              },
              "tags": {
                "maxItems": 40,
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 100
                }
              },
              "author": {
                "type": "string",
                "maxLength": 120
              },
              "topics": {
                "maxItems": 40,
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 100
                }
              },
              "format": {
                "type": "string",
                "maxLength": 60
              },
              "summary": {
                "type": "string",
                "maxLength": 600
              },
              "evergreen": {
                "type": "boolean"
              },
              "pinned": {
                "type": "boolean"
              },
              "recommendable": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "path",
              "title",
              "publishedAt",
              "tags",
              "pinned"
            ],
            "additionalProperties": false
          }
        },
        "readerJourneys": {
          "maxItems": 6,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "description": {
                "type": "string",
                "maxLength": 300
              },
              "paths": {
                "maxItems": 12,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^\\/[a-zA-Z0-9%/_-]+\\/$"
                }
              },
              "subscriber": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "label",
              "description",
              "paths"
            ],
            "additionalProperties": false
          }
        },
        "magazine": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "format": "uri",
              "pattern": "^https:.*"
            },
            "subscriberUrl": {
              "type": "string",
              "format": "uri",
              "pattern": "^https:.*"
            },
            "subscriberLabel": {
              "type": "string",
              "maxLength": 100
            },
            "visitorLabel": {
              "type": "string",
              "maxLength": 100
            }
          },
          "required": [
            "url",
            "subscriberLabel",
            "visitorLabel"
          ],
          "additionalProperties": false
        },
        "topicFeeds": {
          "maxItems": 8,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string",
                "maxLength": 200,
                "pattern": "^\\/[a-zA-Z0-9/_-]+$"
              },
              "tag": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
              }
            },
            "required": [
              "path",
              "tag"
            ],
            "additionalProperties": false
          }
        },
        "path": {
          "type": "string",
          "maxLength": 200,
          "pattern": "^\\/[a-zA-Z0-9/_-]+$"
        },
        "articleSelector": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "readingSelector": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "readingIgnoreSelector": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "targetIds": {
          "minItems": 1,
          "maxItems": 10,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
          }
        },
        "refreshMinutes": {
          "type": "integer",
          "minimum": 5,
          "maximum": 60
        },
        "maxAgeHours": {
          "type": "integer",
          "minimum": 1,
          "maximum": 24
        },
        "topics": {
          "minItems": 1,
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "tag": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
              },
              "terms": {
                "minItems": 1,
                "maxItems": 30,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 2,
                  "maxLength": 100
                }
              }
            },
            "required": [
              "tag",
              "terms"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "kind",
        "path",
        "articleSelector",
        "targetIds",
        "refreshMinutes",
        "maxAgeHours",
        "topics"
      ],
      "additionalProperties": false
    },
    "identityDemo": {
      "type": "object",
      "properties": {
        "segments": {
          "minItems": 1,
          "maxItems": 12,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000
              }
            },
            "required": [
              "id",
              "label",
              "description"
            ],
            "additionalProperties": false
          }
        },
        "scenarios": {
          "minItems": 1,
          "maxItems": 12,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000
              },
              "kind": {
                "type": "string",
                "enum": [
                  "known_person",
                  "known_company",
                  "unlisted_company",
                  "anonymous"
                ]
              },
              "segment": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
              },
              "company": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "industry": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "name",
                  "industry",
                  "description"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "label",
              "description",
              "kind"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "segments",
        "scenarios"
      ],
      "additionalProperties": false
    },
    "simulations": {
      "maxItems": 8,
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              "kind": {
                "type": "string",
                "const": "browse"
              },
              "resourceIds": {
                "minItems": 1,
                "maxItems": 9,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
                }
              }
            },
            "required": [
              "id",
              "label",
              "description",
              "kind",
              "resourceIds"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              "kind": {
                "type": "string",
                "const": "read"
              },
              "resourceIds": {
                "minItems": 1,
                "maxItems": 9,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
                }
              }
            },
            "required": [
              "id",
              "label",
              "description",
              "kind",
              "resourceIds"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              "kind": {
                "type": "string",
                "const": "attention"
              },
              "sectionId": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
              }
            },
            "required": [
              "id",
              "label",
              "description",
              "kind",
              "sectionId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              "kind": {
                "type": "string",
                "const": "purchase"
              },
              "resourceIds": {
                "minItems": 1,
                "maxItems": 1,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
                }
              }
            },
            "required": [
              "id",
              "label",
              "description",
              "kind",
              "resourceIds"
            ],
            "additionalProperties": false
          }
        ]
      }
    },
    "profileTtlMs": {
      "type": "integer",
      "minimum": 60000,
      "maximum": 31536000000
    },
    "eventTtlMs": {
      "type": "integer",
      "minimum": 60000,
      "maximum": 31536000000
    },
    "halfLifeMs": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "maxEvents": {
      "type": "integer",
      "minimum": 1,
      "maximum": 500
    },
    "demoControls": {
      "type": "object",
      "properties": {
        "guidePath": {
          "type": "string",
          "maxLength": 500,
          "pattern": "^\\/.*"
        }
      },
      "required": [
        "guidePath"
      ],
      "additionalProperties": false
    },
    "sections": {
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
          },
          "selector": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "tag": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
          },
          "minVisibleMs": {
            "type": "integer",
            "minimum": 1000,
            "maximum": 9007199254740991
          },
          "path": {
            "type": "string",
            "maxLength": 1000,
            "pattern": "^\\/.*"
          }
        },
        "required": [
          "id",
          "selector",
          "tag",
          "minVisibleMs"
        ],
        "additionalProperties": false
      }
    },
    "products": {
      "maxItems": 500,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "purchasable": {
            "type": "boolean"
          },
          "tags": {
            "maxItems": 30,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 100
            }
          },
          "facts": {
            "maxItems": 30,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 1000
            }
          }
        },
        "required": [
          "id",
          "name",
          "tags",
          "facts"
        ],
        "additionalProperties": false
      }
    },
    "pages": {
      "minItems": 1,
      "maxItems": 500,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
          },
          "path": {
            "type": "string",
            "maxLength": 1000,
            "pattern": "^\\/.*"
          },
          "productId": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
          },
          "kind": {
            "type": "string",
            "const": "article"
          },
          "targets": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
            }
          }
        },
        "required": [
          "id",
          "path",
          "targets"
        ],
        "additionalProperties": false
      }
    },
    "targets": {
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "editorial": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "recommendations"
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 6
                  },
                  "priority": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10
                  },
                  "magazine": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "kind",
                  "count"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "order"
                  },
                  "linkSelector": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "pinnedSelector": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "kind",
                  "linkSelector",
                  "pinnedSelector"
                ],
                "additionalProperties": false
              }
            ]
          },
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "selector": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "mode": {
            "type": "string",
            "enum": [
              "text",
              "component",
              "order",
              "control"
            ]
          },
          "placement": {
            "type": "string",
            "enum": [
              "replace",
              "after"
            ]
          },
          "order": {
            "type": "object",
            "properties": {
              "items": {
                "minItems": 2,
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
                    },
                    "selector": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    }
                  },
                  "required": [
                    "id",
                    "selector"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "items"
            ],
            "additionalProperties": false
          },
          "control": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "select"
                  }
                },
                "required": [
                  "kind"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "buttons"
                  },
                  "optionSelector": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "valueAttribute": {
                    "type": "string",
                    "pattern": "^(data-[a-z][a-z0-9-]*|value)$"
                  }
                },
                "required": [
                  "kind",
                  "optionSelector",
                  "valueAttribute"
                ],
                "additionalProperties": false
              }
            ]
          },
          "defaultVariant": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
          },
          "variants": {
            "minItems": 1,
            "maxItems": 40,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "demoIdentityEntry": {
                  "type": "boolean"
                },
                "demoIdentitySegments": {
                  "maxItems": 12,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
                  }
                },
                "contentTag": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
                },
                "editorialPolicy": {
                  "type": "string",
                  "enum": [
                    "personalized",
                    "contextual",
                    "discovery"
                  ]
                },
                "id": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
                },
                "description": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 2000
                },
                "hypothesis": {
                  "type": "string",
                  "maxLength": 2000
                },
                "audiences": {
                  "maxItems": 20,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "when": {
                  "type": "string",
                  "maxLength": 500
                },
                "value": {
                  "type": "string",
                  "maxLength": 24000
                },
                "componentId": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
                },
                "requiresFacts": {
                  "maxItems": 20,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "requiresAttention": {
                  "type": "object",
                  "properties": {
                    "tag": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
                    },
                    "durationMs": {
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 3600000
                    }
                  },
                  "required": [
                    "tag",
                    "durationMs"
                  ],
                  "additionalProperties": false
                },
                "requiresPurchasedProduct": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
                },
                "requiresDaysSincePurchase": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 365
                },
                "requiresInterest": {
                  "type": "object",
                  "properties": {
                    "tag": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$"
                    },
                    "distinctProducts": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 50
                    }
                  },
                  "required": [
                    "tag",
                    "distinctProducts"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "id",
                "description",
                "hypothesis",
                "audiences",
                "value"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "selector",
          "description",
          "mode",
          "defaultVariant",
          "variants"
        ],
        "additionalProperties": false
      }
    },
    "actions": {
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "selector": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "kind": {
            "type": "string",
            "enum": [
              "product_save",
              "details_open",
              "purchase"
            ]
          }
        },
        "required": [
          "selector",
          "kind"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "id",
    "revision",
    "objective",
    "profileTtlMs",
    "halfLifeMs",
    "maxEvents",
    "products",
    "pages",
    "targets",
    "actions"
  ],
  "additionalProperties": false
}
