{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://axiom.sesimi.app/schemas/axiom_package.schema.json",
  "title": "Axiom package",
  "type": "object",
  "properties": {
    "schema_version": {
      "type": "number",
      "const": 1
    },
    "brand": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "slug",
        "name"
      ],
      "additionalProperties": false
    },
    "collection": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "version": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "promoted_at": {
          "type": "string",
          "format": "date-time",
          "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))$"
        }
      },
      "required": [
        "slug",
        "name",
        "version",
        "promoted_at"
      ],
      "additionalProperties": false
    },
    "content_hash": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "document": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1
        },
        "language": {
          "type": "string",
          "minLength": 2
        }
      },
      "required": [
        "title",
        "language"
      ],
      "additionalProperties": false
    },
    "sections": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "section_id": {
            "type": "string",
            "pattern": "^sec-\\d{2,}$"
          },
          "title": {
            "type": "string",
            "minLength": 1
          },
          "intent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "narrative": {
            "type": "string"
          },
          "position": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "origin": {
            "type": "string",
            "enum": [
              "extracted",
              "authored"
            ]
          },
          "source_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "blocks": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^blk-\\d{4,}$"
                    },
                    "kind": {
                      "type": "string",
                      "const": "text"
                    },
                    "title": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "body": {
                      "type": "string"
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "parentId": {
                      "type": "string",
                      "pattern": "^blk-\\d{4,}$"
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "title",
                    "body",
                    "position"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^blk-\\d{4,}$"
                    },
                    "kind": {
                      "type": "string",
                      "const": "exception_callout"
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "position"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^blk-\\d{4,}$"
                    },
                    "kind": {
                      "type": "string",
                      "const": "do_dont_grid"
                    },
                    "title": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^dd-\\d{4,}$"
                          },
                          "polarity": {
                            "type": "string",
                            "enum": [
                              "do",
                              "dont"
                            ]
                          },
                          "caption": {
                            "type": "string"
                          },
                          "alt": {
                            "type": "string"
                          },
                          "image": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "url": {
                                    "type": "string"
                                  },
                                  "width": {
                                    "anyOf": [
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "height": {
                                    "anyOf": [
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "url",
                                  "width",
                                  "height"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "polarity",
                          "caption",
                          "alt",
                          "image"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "title",
                    "items",
                    "position"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          }
        },
        "required": [
          "section_id",
          "title",
          "intent",
          "narrative"
        ],
        "additionalProperties": false
      }
    },
    "rules": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^rule-\\d{4,}$"
          },
          "statement": {
            "type": "string",
            "minLength": 1
          },
          "category": {
            "type": "string",
            "enum": [
              "logo",
              "color",
              "typography",
              "imagery",
              "layout",
              "offer",
              "language",
              "media",
              "legal",
              "other"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "blocker",
              "warning",
              "informational"
            ]
          },
          "threshold": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "rationale": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "source_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "section_id": {
            "type": "string",
            "pattern": "^sec-\\d{2,}$"
          },
          "section_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "statement",
          "category",
          "severity",
          "threshold",
          "rationale",
          "section_id",
          "section_title"
        ],
        "additionalProperties": false
      }
    },
    "colors": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "tier": {
            "default": null,
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "usage_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "hex": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^#[0-9A-Fa-f]{6}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "rgb": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "r": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 255
                  },
                  "g": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 255
                  },
                  "b": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 255
                  }
                },
                "required": [
                  "r",
                  "g",
                  "b"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "cmyk": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "c": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 100
                },
                "m": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 100
                },
                "y": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 100
                },
                "k": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 100
                },
                "paper": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "coated",
                        "uncoated",
                        "matte",
                        "newsprint",
                        "other"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "c",
                "m",
                "y",
                "k",
                "paper"
              ],
              "additionalProperties": false
            }
          },
          "pantone": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "ral_design": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "oracal": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "scotchcal": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "id": {
            "type": "string",
            "pattern": "^color-\\d{3,}$"
          }
        },
        "required": [
          "name",
          "tier",
          "usage_notes",
          "hex",
          "rgb",
          "cmyk",
          "pantone",
          "ral_design",
          "oracal",
          "scotchcal",
          "id"
        ],
        "additionalProperties": false
      }
    },
    "fonts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "role": {
            "type": "string",
            "minLength": 1
          },
          "weight_examples": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "size_px": {
            "default": null,
            "anyOf": [
              {
                "type": "number",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "line_height": {
            "default": null,
            "anyOf": [
              {
                "type": "number",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "letter_spacing_em": {
            "default": null,
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "font_style": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "normal",
                  "italic"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "fallback_stack": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sample_text": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "string",
            "pattern": "^font-\\d{3,}$"
          },
          "webfont": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "weight": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "weight_range": {
                    "anyOf": [
                      {
                        "type": "array",
                        "prefixItems": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "items": false,
                        "minItems": 2,
                        "maxItems": 2
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "italic": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "weight",
                  "weight_range",
                  "italic"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name",
          "role",
          "weight_examples",
          "size_px",
          "line_height",
          "letter_spacing_em",
          "font_style",
          "fallback_stack",
          "sample_text",
          "id",
          "webfont"
        ],
        "additionalProperties": false
      }
    },
    "logos": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "usage_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "prohibited_uses": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "clear_space": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "unit": {
                    "type": "string",
                    "enum": [
                      "x",
                      "px",
                      "mm",
                      "pt"
                    ]
                  },
                  "basis": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "value",
                  "unit",
                  "basis"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "min_size": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "unit": {
                    "type": "string",
                    "enum": [
                      "px",
                      "mm",
                      "pt",
                      "in"
                    ]
                  },
                  "dimension": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "width",
                          "height"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "value",
                  "unit",
                  "dimension"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "variant": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "primary",
                  "alternate",
                  "mono",
                  "symbol"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "string",
            "pattern": "^logo-\\d{3,}$"
          },
          "lockup": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  },
                  "width": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "height": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "url",
                  "width",
                  "height"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "downloadable": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "usage_notes",
          "prohibited_uses",
          "clear_space",
          "min_size",
          "variant",
          "id",
          "lockup",
          "downloadable"
        ],
        "additionalProperties": false
      }
    },
    "thresholds": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "value": {
            "type": "number"
          },
          "unit": {
            "type": "string",
            "minLength": 1
          },
          "id": {
            "type": "string",
            "pattern": "^threshold-\\d{3,}$"
          }
        },
        "required": [
          "name",
          "value",
          "unit",
          "id"
        ],
        "additionalProperties": false
      }
    },
    "approved_language": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "required_disclaimer",
              "approved_offer_name",
              "prohibited_term",
              "other"
            ]
          },
          "items": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "id": {
            "type": "string",
            "pattern": "^lang-\\d{3,}$"
          }
        },
        "required": [
          "kind",
          "items",
          "id"
        ],
        "additionalProperties": false
      }
    },
    "media_taxonomy": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "minLength": 1
          },
          "eligible": {
            "type": "boolean"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "string",
            "pattern": "^media-\\d{3,}$"
          }
        },
        "required": [
          "kind",
          "eligible",
          "notes",
          "id"
        ],
        "additionalProperties": false
      }
    },
    "examples": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^example-\\d{3,}$"
          },
          "description": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "type": "string",
            "enum": [
              "photograph",
              "illustration",
              "logo",
              "clip_art",
              "diagram",
              "screenshot",
              "swatch",
              "type_specimen",
              "callout",
              "decorative",
              "other"
            ]
          },
          "position": {
            "type": "string",
            "minLength": 1
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "is_compliance_example": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "compliant",
                  "noncompliant",
                  "not_an_example"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "image": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  },
                  "width": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "height": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "url",
                  "width",
                  "height"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "section_id": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "description",
          "kind",
          "position",
          "notes",
          "is_compliance_example"
        ],
        "additionalProperties": false
      }
    },
    "tokens": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^token-\\d{3,}$"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "usage_notes": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 2000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "const": "spacing"
              },
              "value": {
                "type": "number",
                "exclusiveMinimum": 0,
                "maximum": 1000
              },
              "unit": {
                "type": "string",
                "enum": [
                  "px",
                  "rem",
                  "em"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "usage_notes",
              "kind",
              "value",
              "unit"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^token-\\d{3,}$"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "usage_notes": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 2000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "const": "radius"
              },
              "value": {
                "type": "number",
                "minimum": 0,
                "maximum": 1000
              },
              "unit": {
                "type": "string",
                "enum": [
                  "px",
                  "rem",
                  "%"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "usage_notes",
              "kind",
              "value",
              "unit"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^token-\\d{3,}$"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "usage_notes": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 2000
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "const": "motion"
              },
              "duration_ms": {
                "type": "integer",
                "minimum": 0,
                "maximum": 10000
              },
              "easing": {
                "type": "string",
                "pattern": "^(?:linear|ease|ease-in|ease-out|ease-in-out|cubic-bezier\\(-?\\d+(?:\\.\\d+)?, -?\\d+(?:\\.\\d+)?, -?\\d+(?:\\.\\d+)?, -?\\d+(?:\\.\\d+)?\\))$"
              }
            },
            "required": [
              "id",
              "name",
              "usage_notes",
              "kind",
              "duration_ms",
              "easing"
            ],
            "additionalProperties": false
          }
        ]
      }
    }
  },
  "required": [
    "schema_version",
    "brand",
    "collection",
    "content_hash",
    "document",
    "sections",
    "rules",
    "colors",
    "fonts",
    "logos",
    "thresholds",
    "approved_language",
    "media_taxonomy",
    "examples",
    "tokens"
  ],
  "additionalProperties": false
}
