{
  "$id": "https://spec.vitness.me/schemas/atlas/v1.1.0/body-atlas.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "FDS Body Atlas (v1.1.0)",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "id",
    "canonical",
    "views",
    "areas",
    "metadata"
  ],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "id": {
      "type": "string"
    },
    "canonical": {
      "$ref": "#/$defs/canonical"
    },
    "views": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "asset"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "anterior",
              "posterior",
              "left-lateral",
              "right-lateral",
              "superior",
              "inferior"
            ]
          },
          "asset": {
            "type": "object",
            "required": [
              "type",
              "uri"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "svg",
                  "image",
                  "3d"
                ]
              },
              "uri": {
                "type": "string",
                "format": "uri"
              },
              "license": {
                "description": "SPDX identifier where one applies, or a free-text term. Applies to the asset at uri, not to this atlas document. Absence means unstated, not public domain.",
                "type": "string"
              },
              "attribution": {
                "description": "Credit text the asset's terms ask a recipient to show.",
                "type": "string"
              }
            }
          }
        }
      }
    },
    "areas": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "id",
          "canonical",
          "bindings"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "canonical": {
            "type": "object",
            "required": [
              "name",
              "slug"
            ],
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string",
                "pattern": "^[a-z0-9-.]+$"
              },
              "localized": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "lang",
                    "name"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "lang": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": {
                      "type": "string",
                      "minLength": 1
                    },
                    "aliases": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      },
                      "uniqueItems": true
                    }
                  }
                }
              }
            }
          },
          "bindings": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "required": [
                "viewId",
                "selector"
              ],
              "additionalProperties": false,
              "properties": {
                "viewId": {
                  "type": "string"
                },
                "selector": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "attributes": {
      "type": "object",
      "additionalProperties": true
    },
    "extensions": {
      "type": "object",
      "additionalProperties": true
    },
    "metadata": {
      "$ref": "#/$defs/metadata"
    }
  },
  "$defs": {
    "canonical": {
      "type": "object",
      "required": [
        "name",
        "slug"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "slug": {
          "type": "string",
          "pattern": "^[a-z0-9-]{2,}$"
        },
        "description": {
          "type": "string",
          "minLength": 1
        },
        "aliases": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "localized": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "lang",
              "name"
            ],
            "additionalProperties": false,
            "properties": {
              "lang": {
                "type": "string"
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "description": {
                "type": "string",
                "minLength": 1
              },
              "aliases": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "uniqueItems": true
              }
            }
          }
        }
      }
    },
    "metadata": {
      "type": "object",
      "required": [
        "createdAt",
        "updatedAt",
        "status"
      ],
      "additionalProperties": false,
      "properties": {
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "source": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "status": {
          "$ref": "#/$defs/status"
        },
        "deprecated": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "since": {
              "type": "string",
              "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
            },
            "replacedBy": {
              "type": "string"
            }
          }
        },
        "externalRefs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "system",
              "id"
            ],
            "additionalProperties": false,
            "properties": {
              "system": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            }
          }
        },
        "history": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "at": {
                "type": "string",
                "format": "date-time"
              },
              "actor": {
                "type": "string"
              },
              "change": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "review",
        "active",
        "inactive",
        "deprecated"
      ],
      "default": "active"
    }
  }
}
