{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://www.cityjson.org/schemas/2.0.2/geomprimitives.schema.json",
  "title": "CityJSON geometric primitives schema v2.0.2",
  "Semantics": {
    "type": "object",
    "properties": {
      "type": {
        "type": "string",
        "oneOf": [
          {
            "const": "RoofSurface"
          },
          {
            "const": "GroundSurface"
          },
          {
            "const": "WallSurface"
          },
          {
            "const": "ClosureSurface"
          },
          {
            "const": "OuterCeilingSurface"
          },
          {
            "const": "OuterFloorSurface"
          },
          {
            "const": "Window"
          },
          {
            "const": "Door"
          },
          {
            "const": "InteriorWallSurface"
          },
          {
            "const": "CeilingSurface"
          },
          {
            "const": "FloorSurface"
          },                              
          {
            "const": "WaterSurface"
          },
          {
            "const": "WaterGroundSurface"
          },
          {
            "const": "WaterClosureSurface"
          },
          {
            "const": "TrafficArea"
          },
          {
            "const": "AuxiliaryTrafficArea"
          },
          {
            "const": "TransportationHole"
          },
          {
            "const": "TransportationMarking"
          },
          {
            "type": "string",
            "pattern": "(\\+)\\w+"
          }
        ]
      }
    },
    "required": [ 
      "type"
    ]
  },
  "Lods": {
      "enum": [
        "0",   "1",   "2",   "3", 
        "0.0", "0.1", "0.2", "0.3", 
        "1.0", "1.1", "1.2", "1.3", 
        "2.0", "2.1", "2.2", "2.3", 
        "3.0", "3.1", "3.2", "3.3"
      ]
  },
  "Solid": {
    "type": "object",
    "properties": {
      "type": {
        "const": "Solid"
      },
      "lod": {
        "$ref": "#/Lods" 
      },
      "boundaries": {
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "integer"
              },
              "minItems": 1
            },
            "minItems": 1
          },
          "minItems": 1
        },
        "minItems": 1
      },
      "semantics": {
        "type": "object",
        "properties": {
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/Semantics"
            }
          },
          "values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          }
        },
        "required": [
          "surfaces",
          "values"
        ]
      },
      "material": {
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "properties": {
            "values": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              }
            },
            "value": {
              "type": "integer"
            }
          },
          "oneOf": [
            {
              "required": [
                "value"
              ]
            },
            {
              "required": [
                "values"
              ]
            }
          ]
        }
      },
      "texture": {
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "properties": {
            "values": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "array",
                    "items": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "required": [
      "type",
      "lod",
      "boundaries"
    ],
    "additionalProperties": false
  },
  "MultiSolid": {
    "type": "object",
    "properties": {
      "type": {
        "const": "MultiSolid"
      },
      "lod": {
        "$ref": "#/Lods" 
      },
      "boundaries": {
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "minItems": 1
              },
              "minItems": 1
            },
            "minItems": 1
          },
          "minItems": 1
        },
        "minItems": 1
      },
      "semantics": {
        "type": "object",
        "properties": {
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/Semantics"
            }
          },
          "values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              }
            }
          }
        },
        "required": [
          "surfaces",
          "values"
        ]
      },
      "material": {
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "properties": {
            "values": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                }
              }
            },
            "value": {
              "type": "integer"
            }
          },
          "oneOf": [
            {
              "required": [
                "value"
              ]
            },
            {
              "required": [
                "values"
              ]
            }
          ]
        }
      },
      "texture": {
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "properties": {
            "values": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "array",
                      "items": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "required": [
      "type",
      "lod",
      "boundaries"
    ],
    "additionalProperties": false
  },
  "CompositeSolid": {
    "type": "object",
    "properties": {
      "type": {
        "const": "CompositeSolid"
      },
      "lod": {
        "$ref": "#/Lods" 
      },
      "boundaries": {
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "minItems": 1
              },
              "minItems": 1
            },
            "minItems": 1
          },
          "minItems": 1
        },
        "minItems": 1
      },
      "semantics": {
        "type": "object",
        "properties": {
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/Semantics"
            }
          },
          "values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              }
            }
          }
        },
        "required": [
          "surfaces",
          "values"
        ]
      },
      "material": {
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "properties": {
            "values": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                }
              }
            },
            "value": {
              "type": "integer"
            }
          },
          "oneOf": [
            {
              "required": [
                "value"
              ]
            },
            {
              "required": [
                "values"
              ]
            }
          ]
        }
      },
      "texture": {
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "properties": {
            "values": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "array",
                      "items": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "required": [
      "type",
      "lod",
      "boundaries"
    ],
    "additionalProperties": false
  },
  "MultiSurface": {
    "type": "object",
    "properties": {
      "type": {
        "const": "MultiSurface"
      },
      "lod": {
        "$ref": "#/Lods" 
      },
      "boundaries": {
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "minItems": 1
          },
          "minItems": 1
        },
        "minItems": 1
      },
      "semantics": {
        "type": "object",
        "properties": {
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/Semantics"
            }
          },
          "values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": [
                "integer",
                "null"
              ]
            }
          }
        },
        "required": [
          "surfaces",
          "values"
        ]
      },
      "material": {
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "properties": {
            "values": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "value": {
              "type": "integer"
            }
          },
          "oneOf": [
            {
              "required": [
                "value"
              ]
            },
            {
              "required": [
                "values"
              ]
            }
          ]
        }
      },
      "texture": {
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "properties": {
            "values": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "required": [
      "type",
      "lod",
      "boundaries"
    ],
    "additionalProperties": false
  },
  "CompositeSurface": {
    "type": "object",
    "properties": {
      "type": {
        "const": "CompositeSurface"
      },
      "lod": {
        "$ref": "#/Lods" 
      },
      "boundaries": {
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "minItems": 1
          },
          "minItems": 1
        },
        "minItems": 1
      },
      "semantics": {
        "type": "object",
        "properties": {
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/Semantics"
            }
          },
          "values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": [
                "integer",
                "null"
              ]
            }
          }
        },
        "required": [
          "surfaces",
          "values"
        ]
      },
      "material": {
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "properties": {
            "values": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "value": {
              "type": "integer"
            }
          },
          "oneOf": [
            {
              "required": [
                "value"
              ]
            },
            {
              "required": [
                "values"
              ]
            }
          ]
        }
      },
      "texture": {
        "type": "object",
        "additionalProperties": {
          "type": "object",
          "properties": {
            "values": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "required": [
      "type",
      "lod",
      "boundaries"
    ],
    "additionalProperties": false
  },
  "MultiLineString": {
    "type": "object",
    "properties": {
      "type": {
        "const": "MultiLineString"
      },
      "lod": {
        "$ref": "#/Lods" 
      },
      "boundaries": {
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "minItems": 1
        },
        "minItems": 1
      },
      "semantics": {
        "type": "object",
        "properties": {
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/Semantics"
            }
          },
          "values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": [
                "integer",
                "null"
              ]
            }
          }
        },
        "required": [
          "surfaces",
          "values"
        ]
      }      
    },
    "required": [
      "type",
      "lod",
      "boundaries"
    ],
    "additionalProperties": false
  },
  "MultiPoint": {
    "type": "object",
    "properties": {
      "type": {
        "const": "MultiPoint"
      },
      "lod": {
        "$ref": "#/Lods" 
      },
      "boundaries": {
        "type": "array",
        "items": {
          "type": "integer"
        },
        "minItems": 1
      },
      "semantics": {
        "type": "object",
        "properties": {
          "surfaces": {
            "type": "array",
            "items": {
              "$ref": "#/Semantics"
            }
          },
          "values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": [
                "integer",
                "null"
              ]
            }
          }
        },
        "required": [
          "surfaces",
          "values"
        ]
      }      
    },
    "required": [
      "type",
      "lod",
      "boundaries"
    ],
    "additionalProperties": false
  }
}
