{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://recit.dev/schema/v1/webstory.json",
  "x-recit-stability": "stable",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "const": "story"
    },
    "version": {
      "type": "number",
      "const": 1
    },
    "syntax": {
      "type": "string",
      "enum": [
        "md",
        "mdx"
      ]
    },
    "preamble": {
      "type": "string"
    },
    "meta": {
      "type": "object",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "type": "string"
              }
            }
          ]
        },
        "subtitle": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "type": "string"
              }
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "type": "string"
              }
            }
          ]
        },
        "author": {
          "type": "string"
        },
        "date": {
          "type": "string"
        },
        "lang": {
          "type": "string"
        },
        "duration": {
          "anyOf": [
            {
              "type": "number",
              "exclusiveMinimum": 0
            },
            {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              ]
            }
          ],
          "description": "Duration of the story: minutes as a positive number, or a short text (optionally per language)."
        },
        "audience": {
          "description": "Target audience of the story (string or per-language map).",
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "type": "string"
              }
            }
          ]
        },
        "level": {
          "type": "string",
          "enum": [
            "flash",
            "talk",
            "deep-dive"
          ],
          "description": "Format or depth level of the story: flash, talk, or deep-dive."
        }
      },
      "additionalProperties": false
    },
    "data": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "pattern": "^[a-z][a-z0-9_-]*$"
      },
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1
          },
          {
            "type": "object",
            "properties": {
              "src": {
                "type": "string",
                "minLength": 1
              },
              "format": {
                "type": "string",
                "enum": [
                  "csv",
                  "json",
                  "yaml"
                ]
              },
              "columns": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "date",
                    "boolean"
                  ]
                }
              }
            },
            "required": [
              "src"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "rows": {
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "null"
                    ]
                  }
                }
              },
              "columns": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "date",
                    "boolean"
                  ]
                }
              },
              "meta": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Title of the dataset (DCAT `title`)."
                  },
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "HTTP or HTTPS address of the dataset (`https:` or `http:`)."
                  },
                  "publisher": {
                    "type": "string",
                    "description": "Organisation or author publishing the dataset (DCAT `publisher`)."
                  },
                  "license": {
                    "type": "string",
                    "description": "Name or URL of the dataset's license (DCAT `license`)."
                  },
                  "modified": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                      },
                      {
                        "type": "string",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d))|(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?)$"
                      }
                    ],
                    "description": "Last modification date (`YYYY-MM-DD`) or ISO 8601 date-time (DCAT `modified`)."
                  }
                },
                "additionalProperties": false,
                "description": "Provenance metadata of a data source (DCAT field names), used by `::chart` when `source=` is omitted."
              }
            },
            "required": [
              "rows"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "chart": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "chart"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "source": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
              }
            },
            "required": [
              "source"
            ],
            "additionalProperties": {},
            "x-recit-stability": "stable",
            "description": "A data source of a Récit plugin: its other keys are checked by the plugin."
          }
        ]
      }
    },
    "format": {
      "type": "string",
      "const": "webstory"
    },
    "settings": {
      "type": "object",
      "properties": {
        "aspectRatio": {
          "type": "string",
          "enum": [
            "9:16",
            "4:5",
            "1:1"
          ]
        },
        "autoplay": {
          "type": "boolean"
        },
        "dur": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "loop": {
          "type": "boolean"
        },
        "images": {
          "type": "object",
          "properties": {
            "format": {
              "type": "string",
              "enum": [
                "png",
                "jpeg",
                "webp"
              ]
            },
            "scale": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 4
            },
            "cards": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "maxBytes": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "presets": {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "instagram-story",
                  "instagram-post",
                  "square",
                  "linkedin-post",
                  "linkedin-carousel",
                  "tiktok",
                  "og-image",
                  "mpu",
                  "leaderboard"
                ]
              }
            }
          },
          "additionalProperties": false
        },
        "colorMode": {
          "type": "string",
          "enum": [
            "light",
            "dark",
            "system"
          ]
        },
        "theme": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(?!(?:light|dark|system)$)"
            },
            {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "primary": {
                  "type": "string"
                },
                "accent": {
                  "type": "string"
                },
                "fontSans": {
                  "type": "string",
                  "minLength": 1
                },
                "fontMono": {
                  "type": "string",
                  "minLength": 1
                },
                "customCss": {
                  "type": "string"
                },
                "colors": {
                  "type": "object",
                  "properties": {
                    "primary": {
                      "type": "string"
                    },
                    "primaryForeground": {
                      "type": "string"
                    },
                    "accent": {
                      "type": "string"
                    },
                    "accentForeground": {
                      "type": "string"
                    },
                    "background": {
                      "type": "string"
                    },
                    "foreground": {
                      "type": "string"
                    },
                    "card": {
                      "type": "string"
                    },
                    "cardForeground": {
                      "type": "string"
                    },
                    "border": {
                      "type": "string"
                    },
                    "muted": {
                      "type": "string"
                    },
                    "mutedForeground": {
                      "type": "string"
                    }
                  }
                },
                "dark": {
                  "type": "object",
                  "properties": {
                    "primary": {
                      "type": "string"
                    },
                    "primaryForeground": {
                      "type": "string"
                    },
                    "accent": {
                      "type": "string"
                    },
                    "accentForeground": {
                      "type": "string"
                    },
                    "background": {
                      "type": "string"
                    },
                    "foreground": {
                      "type": "string"
                    },
                    "card": {
                      "type": "string"
                    },
                    "cardForeground": {
                      "type": "string"
                    },
                    "border": {
                      "type": "string"
                    },
                    "muted": {
                      "type": "string"
                    },
                    "mutedForeground": {
                      "type": "string"
                    }
                  }
                },
                "chart": {
                  "type": "object",
                  "properties": {
                    "roles": {
                      "type": "object",
                      "properties": {
                        "reference": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "light": {
                                  "type": "string"
                                },
                                "dark": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "light",
                                "dark"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "description": "A CSS color for both modes, or { light, dark }."
                        },
                        "alert": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "light": {
                                  "type": "string"
                                },
                                "dark": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "light",
                                "dark"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "description": "A CSS color for both modes, or { light, dark }."
                        },
                        "solution": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "light": {
                                  "type": "string"
                                },
                                "dark": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "light",
                                "dark"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "description": "A CSS color for both modes, or { light, dark }."
                        },
                        "context": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "light": {
                                  "type": "string"
                                },
                                "dark": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "light",
                                "dark"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "description": "A CSS color for both modes, or { light, dark }."
                        }
                      },
                      "additionalProperties": false,
                      "description": "Colors of the four semantic chart roles (reference, alert, solution, context), each a color or { light, dark }."
                    },
                    "sequential": {
                      "anyOf": [
                        {
                          "minItems": 5,
                          "maxItems": 5,
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        {
                          "type": "object",
                          "properties": {
                            "light": {
                              "minItems": 5,
                              "maxItems": 5,
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "dark": {
                              "minItems": 5,
                              "maxItems": 5,
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "light",
                            "dark"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "description": "5 colors for the sequential scale, one list for both modes or { light, dark }."
                    },
                    "diverging": {
                      "anyOf": [
                        {
                          "minItems": 7,
                          "maxItems": 7,
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        {
                          "type": "object",
                          "properties": {
                            "light": {
                              "minItems": 7,
                              "maxItems": 7,
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "dark": {
                              "minItems": 7,
                              "maxItems": 7,
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "light",
                            "dark"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "description": "7 colors for the diverging scale, one list for both modes or { light, dark }."
                    }
                  },
                  "additionalProperties": false,
                  "description": "Chart palette overrides (plan 55 D4, GR10): semantic role colors and sequential (5 steps) or diverging (7 steps) scales, in light and dark modes."
                },
                "radius": {
                  "type": "string"
                },
                "fonts": {
                  "type": "object",
                  "properties": {
                    "sans": {
                      "type": "string",
                      "minLength": 1
                    },
                    "mono": {
                      "type": "string",
                      "minLength": 1
                    },
                    "heading": {
                      "type": "string",
                      "minLength": 1
                    },
                    "lettering": {
                      "type": "string",
                      "minLength": 1,
                      "description": "The lettering of a webtoon (bubbles, captions and sound effects); defaults to the theme's body font."
                    }
                  }
                },
                "mermaid": {
                  "type": "object",
                  "properties": {
                    "fontSize": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    }
                  }
                },
                "defaultMode": {
                  "not": {}
                },
                "tokens": {
                  "not": {}
                }
              }
            }
          ]
        },
        "brand": {
          "anyOf": [
            {
              "type": "boolean",
              "const": false
            },
            {
              "type": "object",
              "properties": {
                "logo": {
                  "type": "string",
                  "minLength": 1,
                  "description": "Logo: a path or an http(s) URL of an image."
                },
                "mention": {
                  "type": "string",
                  "minLength": 1,
                  "description": "A short line drawn beside the logo."
                },
                "position": {
                  "type": "string",
                  "enum": [
                    "top-left",
                    "top-right",
                    "bottom-left",
                    "bottom-right"
                  ],
                  "description": "The corner of the signature (default bottom-right)."
                },
                "inFilm": {
                  "type": "boolean",
                  "description": "Also draw the signature on every shot of a film; off by default."
                },
                "color": {
                  "type": "string",
                  "description": "Background colour of the signature badge in a film; the text colour is chosen for contrast."
                }
              },
              "additionalProperties": false,
              "description": "The signature (logo, mention) drawn in a reserved corner of a web story card, a film shot, a poster or a banner (plan 54 D8)."
            }
          ],
          "description": "`false` removes the signature of recit.config from this story"
        },
        "channel": {
          "type": "string",
          "minLength": 1,
          "description": "The channel this story is posted on (a free name: `Instagram`, `LinkedIn`)."
        },
        "copy": {
          "anyOf": [
            {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              ]
            },
            {
              "minItems": 1,
              "type": "array",
              "items": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                ]
              }
            }
          ],
          "description": "The text of the post: one text, or several where the first is the post and the others alternative hooks; each a string or a text per language."
        },
        "variants": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\.(csv|json|ya?ml)$",
          "description": "A CSV, JSON or YAML file of rows: the story is rendered once per row, its {{variables}} replaced."
        },
        "rules": {
          "type": "object",
          "properties": {
            "maxGridItems": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "maxGridCols": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "maxBulletPoints": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "maxWordCount": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "enforceAntiOverload": {
              "type": "boolean"
            }
          }
        },
        "cover": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "properties": {
                "src": {
                  "type": "string"
                },
                "alt": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  ]
                }
              },
              "required": [
                "src"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "additionalProperties": {}
    },
    "scenes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "type": "string",
            "minLength": 1
          },
          "dur": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "hold": {
            "type": "number",
            "minimum": 0
          },
          "accent": {
            "type": "string",
            "description": "Accent colour of this scene, replacing the theme accent (highlighted bar, curve, emphasised words)."
          },
          "props": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "background": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {
                  "src": {
                    "type": "string"
                  },
                  "alt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "string"
                        }
                      }
                    ]
                  }
                },
                "required": [
                  "src"
                ],
                "additionalProperties": false
              }
            ]
          },
          "overlay": {
            "type": "string",
            "enum": [
              "none",
              "top",
              "bottom",
              "full"
            ]
          },
          "attrs": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean"
              ]
            }
          },
          "body": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          },
          "cta": {
            "type": "object",
            "properties": {
              "label": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                ]
              },
              "href": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "label",
              "href"
            ],
            "additionalProperties": false
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "kind",
    "version",
    "meta",
    "format",
    "scenes"
  ],
  "additionalProperties": false
}
