{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "unitGroupDataSet": {
      "type": "object",
      "properties": {
        "@xmlns": {
          "type": "string",
          "const": "http://lca.jrc.it/ILCD/UnitGroup"
        },
        "@xmlns:common": {
          "type": "string",
          "const": "http://lca.jrc.it/ILCD/Common"
        },
        "@xmlns:xsi": {
          "type": "string",
          "const": "http://www.w3.org/2001/XMLSchema-instance"
        },
        "@version": {
          "type": "string",
          "const": "1.1"
        },
        "@xsi:schemaLocation": {
          "type": "string",
          "const": "http://lca.jrc.it/ILCD/UnitGroup ../../schemas/ILCD_UnitGroupDataSet.xsd"
        },
        "unitGroupInformation": {
          "type": "object",
          "properties": {
            "dataSetInformation": {
              "type": "object",
              "properties": {
                "common:UUID": {
                  "$ref": "tidas_data_types.json#/$defs/UUID",
                  "description": "Automatically generated Universally Unique Identifier of this data set. Together with the \"Data set version\", the UUID uniquely identifies each data set."
                },
                "common:name": {
                  "$ref": "tidas_data_types.json#/$defs/StringMultiLang",
                  "description": "Name of the unit group, typically indicating for which flow property or group of flow properties it is used. The individual units are named in the \"Units\" section of the \"Unit group data set\""
                },
                "classificationInformation": {
                  "type": "object",
                  "description": "Hierachical classification of the Unit groups; foreseen to be used to structure the Unit group content of the database. (Note: This entry is NOT required for the identification of the Unit group data set. It should nevertheless be avoided to use identical names for Unit groups in the same class.",
                  "properties": {
                    "common:classification": {
                      "type": "object",
                      "description": "Optional statistical or other classification of the data set. Typically also used for structuring LCA databases.",
                      "properties": {
                        "common:class": {
                          "type": "object",
                          "properties": {
                            "@level": {
                              "$ref": "tidas_data_types.json#/$defs/LevelType",
                              "const": "0",
                              "description": "If more than one class is specified in a hierachical classification system, the hierarchy level (1,2,...) could be specified with this attribute of class."
                            },
                            "@classId": {
                              "type": "string",
                              "description": "Unique identifier for the class. [Notes: If such identifiers are also defined in the referenced category file, they should be identical. Identifiers can be UUID's, but also other forms are allowed.]"
                            },
                            "#text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "@level",
                            "@classId",
                            "#text"
                          ],
                          "dependencies": {
                            "@level": {
                              "$ref": "./tidas_unitgroups_category.json#/$defs/UnitGroup"
                            }
                          }
                        },
                        "common:other": {
                          "$ref": "tidas_data_types.json#/$defs/CommonOther"
                        }
                      },
                      "required": [
                        "common:class"
                      ]
                    }
                  },
                  "required": [
                    "common:classification"
                  ]
                },
                "common:generalComment": {
                  "$ref": "tidas_data_types.json#/$defs/FTMultiLang",
                  "description": "Free text for general information about the data set. E.g. coverage of different unit systems, information sources used, etc."
                },
                "common:other": {
                  "$ref": "tidas_data_types.json#/$defs/CommonOther"
                }
              },
              "required": [
                "common:UUID",
                "common:name",
                "classificationInformation"
              ]
            },
            "quantitativeReference": {
              "type": "object",
              "properties": {
                "referenceToReferenceUnit": {
                  "$ref": "tidas_data_types.json#/$defs/Int5"
                },
                "common:other": {
                  "$ref": "tidas_data_types.json#/$defs/CommonOther"
                }
              },
              "required": [
                "referenceToReferenceUnit"
              ]
            },
            "common:other": {
              "$ref": "tidas_data_types.json#/$defs/CommonOther"
            }
          },
          "required": [
            "dataSetInformation",
            "quantitativeReference"
          ]
        },
        "modellingAndValidation": {
          "type": "object",
          "properties": {
            "complianceDeclarations": {
              "type": "object",
              "properties": {
                "compliance": {
                  "description": "One compliance declaration. Multiple declarations may be provided.",
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "common:referenceToComplianceSystem": {
                          "$ref": "tidas_data_types.json#/$defs/GlobalReferenceType"
                        },
                        "common:approvalOfOverallCompliance": {
                          "type": "string",
                          "enum": [
                            "Fully compliant",
                            "Not compliant",
                            "Not defined"
                          ]
                        },
                        "common:other": {
                          "$ref": "tidas_data_types.json#/$defs/CommonOther"
                        }
                      },
                      "required": [
                        "common:referenceToComplianceSystem",
                        "common:approvalOfOverallCompliance"
                      ]
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "common:referenceToComplianceSystem": {
                            "$ref": "tidas_data_types.json#/$defs/GlobalReferenceType"
                          },
                          "common:approvalOfOverallCompliance": {
                            "type": "string",
                            "enum": [
                              "Fully compliant",
                              "Not compliant",
                              "Not defined"
                            ]
                          },
                          "common:other": {
                            "$ref": "tidas_data_types.json#/$defs/CommonOther"
                          }
                        },
                        "required": [
                          "common:referenceToComplianceSystem",
                          "common:approvalOfOverallCompliance"
                        ]
                      },
                      "minItems": 1
                    }
                  ]
                },
                "common:other": {
                  "$ref": "tidas_data_types.json#/$defs/CommonOther"
                }
              },
              "required": [
                "compliance"
              ]
            },
            "common:other": {
              "$ref": "tidas_data_types.json#/$defs/CommonOther"
            }
          },
          "required": [
            "complianceDeclarations"
          ]
        },
        "administrativeInformation": {
          "type": "object",
          "properties": {
            "dataEntryBy": {
              "type": "object",
              "properties": {
                "common:timeStamp": {
                  "$ref": "tidas_data_types.json#/$defs/dateTime",
                  "description": "Date and time stamp of data set generation, typically an automated entry (\"last saved\")."
                },
                "common:referenceToDataSetFormat": {
                  "$ref": "tidas_data_types.json#/$defs/GlobalReferenceType",
                  "description": "\"Source data set\" of the used version of the ILCD format. If additional data format fields have been integrated into the data set file, using the \"namespace\" option, the used format namespace(s) are to be given. This is the case if the data sets carries additional information as specified by other, particular LCA formats, e.g. of other database networks or LCA softwares."
                },
                "common:other": {
                  "$ref": "tidas_data_types.json#/$defs/CommonOther"
                }
              },
              "required": [
                "common:timeStamp",
                "common:referenceToDataSetFormat"
              ]
            },
            "publicationAndOwnership": {
              "type": "object",
              "properties": {
                "common:dataSetVersion": {
                  "allOf": [
                    {
                      "$ref": "tidas_data_types.json#/$defs/Version"
                    }
                  ],
                  "description": "Version number of data set. First two digits refer to major updates, the second two digits to minor revisions and error corrections etc. The third three digits are intended for automatic and internal counting of versions during data set development. Together with the data set's UUID, the \"Data set version\" uniquely identifies each data set."
                },
                "common:referenceToPrecedingDataSetVersion": {
                  "$ref": "tidas_data_types.json#/$defs/GlobalReferenceType",
                  "description": "Last preceding data set, which was replaced by this version. In TIDAS, this reference includes the preceding data set URI, UUID, and version number."
                },
                "common:permanentDataSetURI": {
                  "type": "string",
                  "format": "uri",
                  "description": "URI (i.e. an internet address) of the original of this data set. [Note: This equally globally unique identifier supports users and software tools to identify and retrieve the original version of a data set via the internet or to check for available updates. The URI must not represent an existing WWW address, but it should be unique and point to the data access point, e.g. by combining the data owner's www path with the data set's UUID, e.g. http://www.mycompany.com/lca/processes/50f12420-8855-12db-b606-0900210c9a66.]"
                },
                "common:referenceToOwnershipOfDataSet": {
                  "$ref": "tidas_data_types.json#/$defs/GlobalReferenceType",
                  "description": "\"Contact data set\" of the person or entity who owns this data set. (Note: this is not necessarily the publisher of the data set.)"
                },
                "common:other": {
                  "$ref": "tidas_data_types.json#/$defs/CommonOther"
                }
              },
              "required": [
                "common:dataSetVersion",
                "common:referenceToOwnershipOfDataSet"
              ]
            },
            "common:other": {
              "$ref": "tidas_data_types.json#/$defs/CommonOther"
            }
          },
          "required": [
            "dataEntryBy",
            "publicationAndOwnership"
          ]
        },
        "units": {
          "type": "object",
          "properties": {
            "unit": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "@dataSetInternalID": {
                      "$ref": "tidas_data_types.json#/$defs/Int5"
                    },
                    "name": {
                      "$ref": "tidas_data_types.json#/$defs/String"
                    },
                    "meanValue": {
                      "$ref": "tidas_data_types.json#/$defs/Real"
                    },
                    "generalComment": {
                      "$ref": "tidas_data_types.json#/$defs/StringMultiLang",
                      "description": "General comment on each single unit, typically giving the long name and unit system from which this unit stems, and (if necessary) referring to specifc data sources used, or for workflow purposes about status of \"finalisation\" of an entry etc."
                    },
                    "common:other": {
                      "$ref": "tidas_data_types.json#/$defs/CommonOther"
                    }
                  }
                },
                {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "@dataSetInternalID": {
                        "$ref": "tidas_data_types.json#/$defs/Int5"
                      },
                      "name": {
                        "$ref": "tidas_data_types.json#/$defs/String"
                      },
                      "meanValue": {
                        "$ref": "tidas_data_types.json#/$defs/Real"
                      },
                      "generalComment": {
                        "$ref": "tidas_data_types.json#/$defs/StringMultiLang",
                        "description": "General comment on each single unit, typically giving the long name and unit system from which this unit stems, and (if necessary) referring to specifc data sources used, or for workflow purposes about status of \"finalisation\" of an entry etc."
                      }
                    }
                  }
                }
              ]
            },
            "common:other": {
              "$ref": "tidas_data_types.json#/$defs/CommonOther"
            }
          }
        },
        "common:other": {
          "$ref": "tidas_data_types.json#/$defs/CommonOther"
        }
      },
      "required": [
        "@xmlns",
        "@xmlns:common",
        "@xmlns:xsi",
        "@version",
        "@xsi:schemaLocation",
        "unitGroupInformation",
        "modellingAndValidation",
        "administrativeInformation"
      ]
    }
  },
  "required": [
    "unitGroupDataSet"
  ]
}
