{
  "$id": "https://volito.dev/schema/graphic.v1.json",
  "title": "Volito Graphic spec",
  "description": "One motion graphic: the item or program, its props, brand, shape, timing, motion and sound.",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string"
    },
    "volito": {
      "type": "number",
      "const": 1,
      "description": "The spec format's major version"
    },
    "name": {
      "description": "A label for people; not used to render",
      "type": "string"
    },
    "item": {
      "description": "A pack item: \"essentials/lower-third\", or its id \"lower-third\". Give item, program or code.",
      "type": "string"
    },
    "program": {
      "description": "A path to your own frame(t, $) program (.js), relative to this file",
      "type": "string"
    },
    "code": {
      "description": "Your own frame(t, $) program, inline",
      "type": "string"
    },
    "placement": {
      "description": "For a program: overlay (transparent) or full (draws its own ground)",
      "type": "string",
      "enum": [
        "overlay",
        "full"
      ]
    },
    "props": {
      "description": "The item's props; image props are paths relative to this file or URLs",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    },
    "style": {
      "description": "A built-in style name, or a DESIGN.md path relative to this file",
      "type": "string"
    },
    "colors": {
      "description": "Overrides on the style",
      "type": "object",
      "properties": {
        "accent": {
          "type": "string",
          "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$"
        },
        "accent2": {
          "type": "string",
          "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$"
        },
        "ink": {
          "type": "string",
          "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$"
        },
        "paper": {
          "type": "string",
          "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$"
        },
        "surface": {
          "type": "string",
          "pattern": "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$"
        },
        "mode": {
          "type": "string",
          "enum": [
            "dark",
            "light"
          ]
        },
        "display": {
          "type": "string",
          "description": "A face as \"Family:weight\", e.g. \"Fraunces:900\""
        },
        "text": {
          "type": "string"
        },
        "mono": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "aspect": {
      "description": "\"16:9\", \"9:16\", \"1:1\", \"4:5\" or \"WIDTHxHEIGHT\"",
      "type": "string"
    },
    "duration": {
      "description": "Seconds; the item's default when omitted",
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 600
    },
    "fps": {
      "type": "integer",
      "minimum": 1,
      "maximum": 120
    },
    "width": {
      "description": "Output width in px; the height follows",
      "type": "integer",
      "minimum": 16,
      "maximum": 8192
    },
    "background": {
      "description": "\"transparent\" (default where the format has alpha) or a colour drawn under the graphic",
      "type": "string"
    },
    "words": {
      "description": "Spoken words with start/end seconds, or a transcript file ([{w,s,e}] or Whisper JSON) relative to this file",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "w": {
                "type": "string"
              },
              "s": {
                "type": "number"
              },
              "e": {
                "type": "number"
              }
            },
            "required": [
              "w",
              "s",
              "e"
            ],
            "additionalProperties": false
          }
        },
        {
          "type": "string"
        }
      ]
    },
    "offset": {
      "description": "Where the graphic starts in the transcript, in seconds",
      "type": "number"
    },
    "beats": {
      "description": "Named moments, e.g. { \"in\": 0.4, \"out\": -0.6 }",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "number"
      }
    },
    "motion": {
      "description": "How each part moves: { \"*\": { \"ease\": \"bouncy\" }, \"name\": { \"in\": \"typewriter\" } }",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {}
      }
    },
    "mood": {
      "type": "string",
      "enum": [
        "energetic",
        "elegant",
        "playful",
        "cinematic",
        "glitchy",
        "minimal",
        "retro",
        "kinetic"
      ]
    },
    "seed": {
      "type": "number"
    },
    "speed": {
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 10
    },
    "sound": {
      "description": "true, or { bed: \"Dm\", level: 1 }: a track Volito synthesises, muxed into video",
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "object",
          "properties": {
            "bed": {
              "type": "string"
            },
            "level": {
              "type": "number",
              "minimum": 0,
              "maximum": 2
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "render": {
      "description": "Defaults for volito render; command-line flags win",
      "type": "object",
      "properties": {
        "format": {
          "type": "string",
          "enum": [
            "mov",
            "hevc",
            "webm",
            "mp4",
            "gif",
            "png"
          ]
        },
        "out": {
          "description": "Output path, relative to where you run it",
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "volito"
  ],
  "additionalProperties": false
}
