{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "title": {
              "type": "string",
              "minLength": 2,
              "maxLength": 80
            },
            "description": {
              "type": "string",
              "minLength": 12,
              "maxLength": 1000
            },
            "headline": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "detail": {
              "type": "string",
              "maxLength": 160
            },
            "shareInCommunity": {
              "type": "boolean"
            },
            "version": {
              "type": "number",
              "const": 1
            },
            "appearance": {
              "type": "object",
              "properties": {
                "layout": {
                  "type": "string",
                  "enum": [
                    "card",
                    "strip",
                    "plain"
                  ]
                },
                "accent": {
                  "type": "string",
                  "pattern": "^#[0-9A-Fa-f]{6}$"
                },
                "foreground": {
                  "type": "string",
                  "pattern": "^#[0-9A-Fa-f]{6}$"
                },
                "background": {
                  "type": "string",
                  "pattern": "^#[0-9A-Fa-f]{6}$"
                }
              },
              "required": [
                "layout",
                "accent",
                "foreground",
                "background"
              ],
              "additionalProperties": false
            },
            "mode": {
              "type": "string",
              "const": "alert"
            },
            "durationSeconds": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30
            },
            "events": {
              "minItems": 1,
              "maxItems": 8,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "GIFT",
                  "LIKE",
                  "FOLLOW",
                  "SHARE",
                  "COMMENT",
                  "JOIN",
                  "SUBSCRIBE",
                  "LEVEL_UP"
                ]
              },
              "uniqueItems": true
            }
          },
          "required": [
            "title",
            "description",
            "headline",
            "detail",
            "version",
            "appearance",
            "mode",
            "durationSeconds"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "title": {
              "type": "string",
              "minLength": 2,
              "maxLength": 80
            },
            "description": {
              "type": "string",
              "minLength": 12,
              "maxLength": 1000
            },
            "headline": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "detail": {
              "type": "string",
              "maxLength": 160
            },
            "shareInCommunity": {
              "type": "boolean"
            },
            "version": {
              "type": "number",
              "const": 1
            },
            "appearance": {
              "type": "object",
              "properties": {
                "layout": {
                  "type": "string",
                  "enum": [
                    "card",
                    "strip",
                    "plain"
                  ]
                },
                "accent": {
                  "type": "string",
                  "pattern": "^#[0-9A-Fa-f]{6}$"
                },
                "foreground": {
                  "type": "string",
                  "pattern": "^#[0-9A-Fa-f]{6}$"
                },
                "background": {
                  "type": "string",
                  "pattern": "^#[0-9A-Fa-f]{6}$"
                }
              },
              "required": [
                "layout",
                "accent",
                "foreground",
                "background"
              ],
              "additionalProperties": false
            },
            "mode": {
              "type": "string",
              "const": "live"
            },
            "metric": {
              "type": "string",
              "enum": [
                "gifts",
                "coins",
                "likes",
                "follows",
                "shares",
                "comments",
                "joins",
                "subscribes"
              ]
            },
            "goal": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000000
            },
            "showProgress": {
              "type": "boolean"
            }
          },
          "required": [
            "title",
            "description",
            "headline",
            "detail",
            "version",
            "appearance",
            "mode",
            "metric",
            "goal",
            "showProgress"
          ],
          "additionalProperties": false
        }
      ]
    },
    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "title": {
              "type": "string",
              "minLength": 2,
              "maxLength": 80
            },
            "description": {
              "type": "string",
              "minLength": 12,
              "maxLength": 1000
            },
            "headline": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "detail": {
              "type": "string",
              "maxLength": 160
            },
            "shareInCommunity": {
              "type": "boolean"
            },
            "version": {
              "type": "number",
              "const": 2
            },
            "program": {
              "type": "string",
              "minLength": 1,
              "maxLength": 32768
            },
            "renderer": {
              "type": "string",
              "enum": [
                "2d",
                "webgl2"
              ]
            },
            "fps": {
              "type": "integer",
              "minimum": 12,
              "maximum": 60
            },
            "images": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_-]{0,31}$"
              },
              "additionalProperties": {
                "type": "object",
                "properties": {
                  "mime": {
                    "type": "string",
                    "enum": [
                      "image/png",
                      "image/jpeg",
                      "image/webp"
                    ]
                  },
                  "data": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 196608,
                    "pattern": "^[A-Za-z0-9+/]+={0,2}$"
                  }
                },
                "required": [
                  "mime",
                  "data"
                ],
                "additionalProperties": false
              }
            },
            "mode": {
              "type": "string",
              "const": "alert"
            },
            "durationSeconds": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30
            },
            "events": {
              "minItems": 1,
              "maxItems": 8,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "GIFT",
                  "LIKE",
                  "FOLLOW",
                  "SHARE",
                  "COMMENT",
                  "JOIN",
                  "SUBSCRIBE",
                  "LEVEL_UP"
                ]
              },
              "uniqueItems": true
            }
          },
          "required": [
            "title",
            "description",
            "headline",
            "detail",
            "version",
            "program",
            "mode",
            "durationSeconds"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "title": {
              "type": "string",
              "minLength": 2,
              "maxLength": 80
            },
            "description": {
              "type": "string",
              "minLength": 12,
              "maxLength": 1000
            },
            "headline": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "detail": {
              "type": "string",
              "maxLength": 160
            },
            "shareInCommunity": {
              "type": "boolean"
            },
            "version": {
              "type": "number",
              "const": 2
            },
            "program": {
              "type": "string",
              "minLength": 1,
              "maxLength": 32768
            },
            "renderer": {
              "type": "string",
              "enum": [
                "2d",
                "webgl2"
              ]
            },
            "fps": {
              "type": "integer",
              "minimum": 12,
              "maximum": 60
            },
            "images": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_-]{0,31}$"
              },
              "additionalProperties": {
                "type": "object",
                "properties": {
                  "mime": {
                    "type": "string",
                    "enum": [
                      "image/png",
                      "image/jpeg",
                      "image/webp"
                    ]
                  },
                  "data": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 196608,
                    "pattern": "^[A-Za-z0-9+/]+={0,2}$"
                  }
                },
                "required": [
                  "mime",
                  "data"
                ],
                "additionalProperties": false
              }
            },
            "mode": {
              "type": "string",
              "const": "live"
            },
            "metric": {
              "type": "string",
              "enum": [
                "gifts",
                "coins",
                "likes",
                "follows",
                "shares",
                "comments",
                "joins",
                "subscribes"
              ]
            },
            "goal": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000000
            },
            "showProgress": {
              "type": "boolean"
            }
          },
          "required": [
            "title",
            "description",
            "headline",
            "detail",
            "version",
            "program",
            "mode",
            "metric",
            "goal",
            "showProgress"
          ],
          "additionalProperties": false
        }
      ]
    }
  ],
  "title": "AnimStream Widget Package"
}
