{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Shared brand kit contract 1.1.0",
  "type": "object",
  "properties": {
    "version": {
      "const": "1.1.0"
    },
    "approvals": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "record": {
            "type": "string",
            "minLength": 1
          },
          "authority": {
            "type": "string",
            "minLength": 1
          },
          "date": {
            "type": "string",
            "pattern": "^20[0-9]{2}-[0-9]{2}-[0-9]{2}$"
          },
          "scope": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^/"
            },
            "minItems": 1
          },
          "summary": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": ["id", "record", "authority", "date", "scope", "summary"],
        "additionalProperties": false
      },
      "minItems": 0
    },
    "naming": {
      "type": "object",
      "properties": {
        "product": {
          "type": "string",
          "minLength": 1
        },
        "linear": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "documented",
            "proposed",
            "missing",
            "deprecated",
            "approved"
          ]
        },
        "source": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$"
        },
        "approval": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$"
        }
      },
      "required": ["product", "linear", "status", "source"],
      "additionalProperties": false
    },
    "assets": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "path": {
            "type": "string",
            "pattern": "^assets/[a-z0-9][a-z0-9.-]*\\.(jpg|jpeg|png|svg|webp|woff2|txt)$"
          },
          "kind": {
            "enum": ["logo", "font", "license", "photo", "icon"]
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "rights": {
            "type": "string",
            "minLength": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "documented",
              "proposed",
              "missing",
              "deprecated",
              "approved"
            ]
          },
          "source": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "approval": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          }
        },
        "required": [
          "id",
          "path",
          "kind",
          "sha256",
          "rights",
          "status",
          "source"
        ],
        "additionalProperties": false
      },
      "minItems": 0
    },
    "logoVariants": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "label": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "enum": [
              "original",
              "vector",
              "monochrome",
              "negative",
              "horizontal"
            ]
          },
          "assetId": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              },
              {
                "type": "null"
              }
            ]
          },
          "clearSpace": {
            "type": "object",
            "properties": {
              "measurement": {
                "const": "file-width"
              },
              "ratio": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "documented",
                  "proposed",
                  "missing",
                  "deprecated",
                  "approved"
                ]
              },
              "source": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              },
              "approval": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              }
            },
            "required": ["measurement", "ratio", "status", "source"],
            "additionalProperties": false
          },
          "minSize": {
            "type": "object",
            "properties": {
              "screenPx": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "printMm": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "documented",
                  "proposed",
                  "missing",
                  "deprecated",
                  "approved"
                ]
              },
              "source": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              },
              "approval": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              }
            },
            "required": ["screenPx", "printMm", "status", "source"],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "documented",
              "proposed",
              "missing",
              "deprecated",
              "approved"
            ]
          },
          "source": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "approval": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          }
        },
        "required": [
          "id",
          "label",
          "kind",
          "assetId",
          "clearSpace",
          "minSize",
          "status",
          "source"
        ],
        "additionalProperties": false
      },
      "minItems": 5
    },
    "typography": {
      "type": "object",
      "properties": {
        "mode": {
          "enum": ["system-only", "licensed-local"]
        },
        "files": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "assetId": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              },
              "licenseAssetId": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              },
              "family": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9 -]+$"
              },
              "weight": {
                "type": "integer",
                "minimum": 100,
                "maximum": 900
              }
            },
            "required": ["assetId", "licenseAssetId", "family", "weight"],
            "additionalProperties": false
          },
          "minItems": 0
        },
        "status": {
          "type": "string",
          "enum": [
            "documented",
            "proposed",
            "missing",
            "deprecated",
            "approved"
          ]
        },
        "source": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$"
        },
        "approval": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$"
        }
      },
      "required": ["mode", "files", "status", "source"],
      "additionalProperties": false
    },
    "contact": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "channels": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1
                  },
                  "value": {
                    "type": "string",
                    "minLength": 1
                  },
                  "url": {
                    "type": "string",
                    "minLength": 1
                  },
                  "kind": {
                    "enum": ["email", "phone", "website", "booking"]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "documented",
                      "proposed",
                      "missing",
                      "deprecated",
                      "approved"
                    ]
                  },
                  "source": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9-]*$"
                  },
                  "approval": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9-]*$"
                  }
                },
                "required": [
                  "label",
                  "value",
                  "url",
                  "kind",
                  "status",
                  "source"
                ],
                "additionalProperties": false
              },
              "minItems": 1
            }
          },
          "required": ["channels"],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "media": {
      "type": "object",
      "properties": {
        "policy": {
          "const": "licensed-only-no-personal-data"
        },
        "photos": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "assetId": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              },
              "licenseAssetId": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              },
              "personalData": {
                "const": "none"
              }
            },
            "required": ["assetId", "licenseAssetId", "personalData"],
            "additionalProperties": false
          },
          "minItems": 0
        },
        "icons": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "assetId": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              },
              "licenseAssetId": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              },
              "personalData": {
                "const": "none"
              }
            },
            "required": ["assetId", "licenseAssetId", "personalData"],
            "additionalProperties": false
          },
          "minItems": 0
        },
        "status": {
          "type": "string",
          "enum": [
            "documented",
            "proposed",
            "missing",
            "deprecated",
            "approved"
          ]
        },
        "source": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$"
        },
        "approval": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$"
        }
      },
      "required": ["policy", "photos", "icons", "status", "source"],
      "additionalProperties": false
    }
  },
  "required": [
    "version",
    "approvals",
    "naming",
    "assets",
    "logoVariants",
    "typography",
    "contact",
    "media"
  ],
  "additionalProperties": false
}
