{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "CityJSON metadata schema v1.0.3",
  "definitions": {
    "presentLoDs": {
      "type": "object",
      "patternProperties": {
        "^[0-9](\\.[0-9])?$": {
          "type": "integer"
        }
      },
      "additionalProperties": false
    },
    "thematicModels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },

    "contactDetails": {
      "type": "object",
      "properties": {
        "contactName": {
          "type": "string"
        },
        "phone": {
          "type": "string"
        },
        "address": {
          "type": "string"
        },
        "emailAddress": {
          "type": "string",
          "format": "email"
        }
      },
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "contactType": {
              "type": "string",
              "enum": [
                "individual"
              ]
            },
            "role": {
              "type": "string",
              "description": "from ISO 19115 codelist",
              "enum": [
                "resourceProvider",
                "custodian",
                "owner",
                "user",
                "distributor",
                "originator",
                "pointOfContact",
                "principalInvestigator",
                "processor",
                "publisher",
                "author",
                "sponsor",
                "co-author",
                "collaborator",
                "editor",
                "mediator",
                "rightsHolder",
                "contributor",
                "funder",
                "stakeholder"
              ]
            },
            "organization": {
              "type": "string"
            }
          },
          "required": [
            "contactType"
          ]
        },
        {
          "type": "object",
          "properties": {
            "contactType": {
              "type": "string",
              "enum": [
                "organization"
              ]
            },
            "website": {
              "type": "string",
              "format": "uri",
              "pattern": "^(https?)://"
            }
          },
          "required": [
            "contactType"
          ]
        }
      ]
    },
    "featureData": {
      "type": "object",
      "properties": {
        "uniqueFeatureCount": {
          "type": "integer"
        },
        "aggregateFeatureCount": {
          "type": "integer"
        },
        "presentLoDs": {
          "$ref": "#/definitions/presentLoDs"
        }
      },
      "additionalProperties": false
    }
  },
  "metadata": {
    "type": "object",
    "properties": {
      "citymodelIdentifier": {
        "type": "string"
      },
      "datasetTitle": {
        "type": "string"
      },
      "datasetReferenceDate": {
        "type": "string",
        "format": "date"
      },
      "geographicLocation": {
        "type": "string",
        "description": "the name of the area for instance"
      },
      "datasetLanguage": {
        "type": "string"
      },
      "datasetCharacterSet": {
        "type": "string"
      },
      "datasetTopicCategory": {
        "type": "string",
        "description": "from ISO19115 codelist",
        "enum": [
          "farming",
          "bioata",
          "boundaries",
          "climatology",
          "meteorology",
          "atmosphere",
          "economy",
          "elevation",
          "environment",
          "geoscientificInformation",
          "health",
          "imageryBaseMapsEarthCover",
          "intelligenceMilitary",
          "inlandWaters",
          "location",
          "oceans",
          "planningCadastre",
          "society",
          "structure",
          "transportation",
          "utilitiesCommunication",
          "extraTerrestrial",
          "disaster"
        ]
      },
      "distributionFormatVersion": {
        "type": "string",
        "pattern": "^(\\d\\.)(\\d)$"
      },
      "spatialRepresentationType": {
        "type": "string",
        "description": "from ISO19115 codelist",
        "enum": [
          "vector",
          "grid",
          "TIN",
          "textTable",
          "stereoModel",
          "video"
        ]
      },
      "referenceSystem": {
        "type": "string",
        "pattern": "^urn:ogc:def:crs:EPSG::[0-9]{4,5}$"
      },
      "onlineResource": {
        "type": "string",
        "format": "uri",
        "pattern": "^(https?|ftp)://"
      },
      "fileIdentifier": {
        "type": "string"
      },
      "datasetPointOfContact": {
        "$ref": "#/definitions/contactDetails"
      },
      "metadataStandard": {
        "type": "string"
      },
      "metadataStandardVersion": {
        "type": "string"
      },
      "metadataLanguage": {
        "type": "string"
      },
      "metadataCharacterSet": {
        "type": "string"
      },
      "metadataDateStamp": {
        "type": "string",
        "format": "date"
      },
      "metadataPointOfContact": {
        "$ref": "#/definitions/contactDetails"
      },
      "lineage": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "statement": {
              "type": "string"
            },
            "scope": {
              "type": "string"
            },
            "additionalDocumentation": {
              "type": "string",
              "format": "uri",
              "pattern": "^(https?|ftp)://"
            },
            "featureIDs": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "thematicModels": {
              "$ref": "#/definitions/thematicModels"
            },
            "source": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "sourceSpatialResolution": {
                    "type": "string"
                  },
                  "sourceReferenceSystem": {
                    "type": "string",
                    "pattern": "^urn:ogc:def:crs:EPSG::[0-9]{4,5}$"
                  },
                  "sourceCitation": {
                    "type": "string",
                    "format": "uri",
                    "pattern": "^(https?|ftp)://"
                  },
                  "sourceMetadata": {
                    "type": "string",
                    "format": "uri",
                    "pattern": "^(https?|ftp)://"
                  },
                  "scope": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            },
            "processStep": {
              "type": "object",
              "properties": {
                "description": {
                  "type": "string"
                },
                "rationale": {
                  "type": "string"
                },
                "stepDateTime": {
                  "type": "string",
                  "format": "date-time"
                },
                "processor": {
                  "$ref": "#/definitions/contactDetails"
                },
                "reference": {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^(https?|ftp)://"
                },
                "scope": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          }
        }
      },
      "geographicalExtent": {
        "type": "array",
        "items": {
          "type": "number"
        },
        "minItems": 6,
        "maxItems": 6
      },
      "temporalExtent": {
        "type": "object",
        "properties": {
          "startDate": {
            "type": "string",
            "format": "date-time"
          },
          "endDate": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "abstract": {
        "type": "string"
      },
      "specificUsage": {
        "type": "string"
      },
      "keywords": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "constraints": {
        "type": "object",
        "properties": {
          "legalConstraints": {
            "type": "string",
            "enum": [
              "copyright",
              "patent",
              "patentPending",
              "trademark",
              "licence",
              "intellectualPropertyRights",
              "restricted",
              "otherRestrictions",
              "unrestricted",
              "licenseUnrestricted",
              "licenseEndUser",
              "licenseDistributor",
              "private",
              "statutory",
              "confidential",
              "sensitiveButUnclassified",
              "in-confidence"
            ]
          },
          "securityConstraints": {
            "type": "string",
            "enum": [
              "unclassified",
              "restricted",
              "confidential",
              "secret",
              "topSecret",
              "sensitiveButUnclassified",
              "forOfficialUseOnly",
              "protected",
              "limitedDistribution"
            ]
          },
          "userNote": {
            "type": "string"
          }
        }
      },
      "thematicModels": {
        "$ref": "#/definitions/thematicModels"
      },
      "textures": {
        "type": "string",
        "enum": [
          "present",
          "absent"
        ]
      },
      "materials": {
        "type": "string",
        "enum": [
          "present",
          "absent"
        ]
      },
      "presentLoDs": {
        "$ref": "#/definitions/presentLoDs"
      },
      "cityfeatureMetadata": {
        "type": "object",
        "additionalProperties": {
          "$ref": "#/definitions/featureData"
        }
      }
    }
  }
}