{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Jiayu Sticker Pack v2",
  "type": "object",
  "required": [
    "version",
    "id",
    "revision",
    "name",
    "publisher",
    "type",
    "width",
    "height",
    "stickers"
  ],
  "properties": {
    "version": {
      "type": "integer",
      "const": 2
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$"
    },
    "revision": {
      "type": "integer",
      "minimum": 1
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 40,
      "pattern": "\\S"
    },
    "publisher": {
      "type": "string",
      "minLength": 1,
      "maxLength": 40,
      "pattern": "\\S"
    },
    "type": {
      "enum": [
        "static",
        "animated"
      ]
    },
    "width": {
      "type": "integer",
      "const": 512
    },
    "height": {
      "type": "integer",
      "const": 512
    },
    "stickers": {
      "type": "array",
      "minItems": 1,
      "maxItems": 60,
      "items": {
        "$ref": "#/$defs/sticker"
      }
    }
  },
  "if": {
    "properties": {
      "type": {
        "const": "static"
      }
    },
    "required": [
      "type"
    ]
  },
  "then": {
    "properties": {
      "stickers": {
        "items": {
          "properties": {
            "mime": {
              "enum": [
                "image/png",
                "image/jpeg",
                "image/webp"
              ]
            }
          }
        }
      }
    }
  },
  "else": {
    "properties": {
      "stickers": {
        "items": {
          "properties": {
            "mime": {
              "enum": [
                "image/gif",
                "image/apng",
                "image/webp"
              ]
            }
          }
        }
      }
    }
  },
  "$defs": {
    "sticker": {
      "type": "object",
      "required": [
        "id",
        "label",
        "mime",
        "image"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$"
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 40,
          "pattern": "\\S"
        },
        "mime": {
          "enum": [
            "image/png",
            "image/jpeg",
            "image/webp",
            "image/gif",
            "image/apng"
          ]
        },
        "image": {
          "type": "string",
          "minLength": 4,
          "contentEncoding": "base64"
        }
      }
    }
  }
}
