{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "1.0.0"
    },
    "concepts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "concept_id": {
            "type": "string",
            "pattern": "^concept_[a-z0-9]{8,32}$"
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
          },
          "label": {
            "type": "string",
            "minLength": 1
          },
          "aliases": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "definition": {
            "type": "string",
            "minLength": 1
          },
          "external_mappings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "scheme_id": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]*_[a-z0-9]{8,32}$"
                },
                "scheme_label": {
                  "type": "string",
                  "minLength": 1
                },
                "target_id": {
                  "type": "string",
                  "minLength": 1
                },
                "relation": {
                  "type": "string",
                  "enum": [
                    "exact",
                    "close",
                    "broader",
                    "narrower"
                  ]
                },
                "uri": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "required": [
                "scheme_id",
                "scheme_label",
                "target_id",
                "relation",
                "uri"
              ],
              "additionalProperties": false
            }
          },
          "value_schemes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]*_[a-z0-9]{8,32}$"
                },
                "version": {
                  "type": "string",
                  "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1
                },
                "representation": {
                  "type": "string",
                  "minLength": 1
                },
                "value_behaviour": {
                  "type": "string",
                  "minLength": 1
                },
                "external_uri": {
                  "type": "string",
                  "format": "uri"
                },
                "geography_levels": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "value": {
                        "type": "string",
                        "minLength": 1
                      },
                      "label": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "value",
                      "label"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "id",
                "version",
                "label",
                "representation",
                "value_behaviour",
                "geography_levels"
              ],
              "additionalProperties": false
            }
          },
          "hierarchies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]*_[a-z0-9]{8,32}$"
                },
                "version": {
                  "type": "string",
                  "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
                },
                "type": {
                  "type": "string",
                  "minLength": 1
                },
                "levels": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "label": {
                        "type": "string",
                        "minLength": 1
                      },
                      "order": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "id",
                      "label",
                      "order"
                    ],
                    "additionalProperties": false
                  }
                },
                "approved_edge_count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "id",
                "version",
                "type",
                "levels",
                "approved_edge_count"
              ],
              "additionalProperties": false
            }
          },
          "bound_columns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "asset_id": {
                  "type": "string",
                  "pattern": "^(?:[a-z0-9]+(?:-[a-z0-9]+)*\\/){3}[a-z0-9]+(?:-[a-z0-9]+)*$"
                },
                "column": {
                  "type": "string",
                  "minLength": 1
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "dimension",
                    "measure",
                    "attribute",
                    "time",
                    "geography"
                  ]
                },
                "represented_variable_id": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]*_[a-z0-9]{8,32}$"
                },
                "conceptual_variable_id": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]*_[a-z0-9]{8,32}$"
                },
                "value_scheme_id": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]*_[a-z0-9]{8,32}$"
                },
                "value_scheme_version": {
                  "type": "string",
                  "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
                }
              },
              "required": [
                "asset_id",
                "column",
                "role",
                "represented_variable_id",
                "conceptual_variable_id",
                "value_scheme_id",
                "value_scheme_version"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "concept_id",
          "slug",
          "label",
          "aliases",
          "external_mappings",
          "value_schemes",
          "hierarchies",
          "bound_columns"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "schema_version",
    "concepts"
  ],
  "additionalProperties": false
}
