{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$defs": {
    "CASNumber": {
      "description": "CAS Number, leading zeros are requried.",
      "type": "string",
      "format": "cas-number",
      "pattern": "^[0-9]{2,7}-[0-9]{2}-[0-9]$"
    },
    "FT": {
      "type": "string",
      "description": "Free text with an unlimited length."
    },
    "Languages": {
      "description": "TIDAS Languages enumeration.",
      "type": "string",
      "enum": [
        "aa",
        "ab",
        "ae",
        "af",
        "ak",
        "am",
        "an",
        "ar",
        "as",
        "av",
        "ay",
        "az",
        "ba",
        "be",
        "bg",
        "bh",
        "bi",
        "bm",
        "bn",
        "bo",
        "br",
        "bs",
        "ca",
        "ce",
        "ch",
        "co",
        "cr",
        "cs",
        "cu",
        "cv",
        "cy",
        "da",
        "de",
        "dv",
        "dz",
        "ee",
        "el",
        "en",
        "eo",
        "es",
        "et",
        "eu",
        "fa",
        "ff",
        "fi",
        "fj",
        "fo",
        "fr",
        "fy",
        "ga",
        "gd",
        "gl",
        "gn",
        "gu",
        "gv",
        "ha",
        "he",
        "hi",
        "ho",
        "hr",
        "ht",
        "hu",
        "hy",
        "hz",
        "ia",
        "id",
        "ie",
        "ig",
        "ii",
        "ik",
        "io",
        "is",
        "it",
        "iu",
        "ja",
        "jv",
        "ka",
        "kg",
        "ki",
        "kj",
        "kk",
        "kl",
        "km",
        "kn",
        "ko",
        "kr",
        "ks",
        "ku",
        "kv",
        "kw",
        "ky",
        "la",
        "lb",
        "lg",
        "li",
        "ln",
        "lo",
        "lt",
        "lu",
        "lv",
        "mg",
        "mh",
        "mi",
        "mk",
        "ml",
        "mn",
        "mo",
        "mr",
        "ms",
        "mt",
        "my",
        "na",
        "nb",
        "nd",
        "ne",
        "ng",
        "nl",
        "nn",
        "no",
        "nr",
        "nv",
        "ny",
        "oc",
        "oj",
        "om",
        "or",
        "os",
        "pa",
        "pi",
        "pl",
        "ps",
        "pt",
        "qu",
        "rm",
        "rn",
        "ro",
        "ru",
        "rw",
        "sa",
        "sc",
        "sd",
        "se",
        "sg",
        "si",
        "sk",
        "sl",
        "sm",
        "sn",
        "so",
        "sq",
        "sr",
        "ss",
        "st",
        "su",
        "sv",
        "sw",
        "ta",
        "te",
        "tg",
        "th",
        "ti",
        "tk",
        "tl",
        "tn",
        "to",
        "tr",
        "ts",
        "tt",
        "tw",
        "ty",
        "ug",
        "uk",
        "ur",
        "uz",
        "ve",
        "vi",
        "vo",
        "wa",
        "wo",
        "xh",
        "yi",
        "yo",
        "za",
        "zh",
        "zu"
      ]
    },
    "LocalizedTextItem": {
      "description": "Language-tagged text with optional script checks for selected languages.",
      "type": "object",
      "properties": {
        "@xml:lang": {
          "$ref": "#/$defs/Languages"
        },
        "#text": {
          "type": "string"
        }
      },
      "required": [
        "@xml:lang",
        "#text"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "@xml:lang": {
                "const": "zh"
              }
            },
            "required": [
              "@xml:lang"
            ]
          },
          "then": {
            "properties": {
              "#text": {
                "pattern": "[\\u3400-\\u4DBF\\u4E00-\\u9FFF\\uF900-\\uFAFF]"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "@xml:lang": {
                "const": "en"
              }
            },
            "required": [
              "@xml:lang"
            ]
          },
          "then": {
            "properties": {
              "#text": {
                "not": {
                  "pattern": "[\\u3400-\\u4DBF\\u4E00-\\u9FFF\\uF900-\\uFAFF]"
                }
              }
            }
          }
        }
      ]
    },
    "LocalizedText500Item": {
      "description": "Language-tagged text with a maximum length of 500 characters.",
      "allOf": [
        {
          "$ref": "#/$defs/LocalizedTextItem"
        },
        {
          "properties": {
            "#text": {
              "maxLength": 500
            }
          }
        }
      ]
    },
    "AnnualSupplyOrProductionVolumeTextItem": {
      "description": "Language-tagged annual supply or production volume text. The text must start with a real number followed by whitespace and a non-empty unit or context suffix.",
      "allOf": [
        {
          "$ref": "#/$defs/LocalizedText500Item"
        },
        {
          "properties": {
            "#text": {
              "pattern": "^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)([Ee][+-]?\\d+)?\\s+\\S.*$"
            }
          }
        }
      ]
    },
    "AnnualSupplyOrProductionVolumeMultiLang": {
      "description": "Multi-language annual supply or production volume text with a numeric prefix and unit or context suffix.",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AnnualSupplyOrProductionVolumeTextItem"
          },
          "uniqueItems": true
        },
        {
          "$ref": "#/$defs/AnnualSupplyOrProductionVolumeTextItem"
        }
      ]
    },
    "LocalizedText1000Item": {
      "description": "Language-tagged text with a maximum length of 1000 characters.",
      "allOf": [
        {
          "$ref": "#/$defs/LocalizedTextItem"
        },
        {
          "properties": {
            "#text": {
              "maxLength": 1000
            }
          }
        }
      ]
    },
    "StringMultiLang": {
      "description": "Multi-language string with a maximum length of 500 characters",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LocalizedText500Item"
          },
          "uniqueItems": true
        },
        {
          "$ref": "#/$defs/LocalizedText500Item"
        }
      ]
    },
    "Int1": {
      "description": "1-digit integer number",
      "type": "string",
      "pattern": "^[0-9]$"
    },
    "Int5": {
      "description": "5-digit integer number",
      "type": "string",
      "pattern": "^(0|[1-9]\\d{0,4})$"
    },
    "Int6": {
      "description": "6-digit integer number",
      "type": "string",
      "pattern": "^(0|[1-9]\\d{0,5})$"
    },
    "LevelType": {
      "description": "1-digit integer number, must be equal to or greater than 0",
      "$ref": "#/$defs/Int1"
    },
    "Perc": {
      "description": "percentage amount (ILCD Perc: decimal, totalDigits=5, fractionDigits=3)",
      "type": "string",
      "pattern": "^[+-]?(\\d{1,5}|\\d{1,4}\\.\\d|\\d{1,3}\\.\\d{2}|\\d{1,2}\\.\\d{3})$"
    },
    "MatR": {
      "description": "Mathematical rule",
      "type": "string"
    },
    "MatV": {
      "description": "Mathematical variable or parameter",
      "type": "string"
    },
    "Real": {
      "description": "38-digit real number",
      "type": "string",
      "pattern": "^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)([Ee][+-]?\\d+)?$"
    },
    "ST": {
      "description": "Short text with a maximum length of 1000 characters",
      "type": "string",
      "maxLength": 1000
    },
    "String": {
      "description": "String with a maximum length of 500 characters. Must have a minimum length of 1.",
      "type": "string",
      "maxLength": 500,
      "minLength": 1
    },
    "STMultiLang": {
      "description": "Multi-lang short text with a maximum length of 1000 characters.",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LocalizedText1000Item"
          },
          "uniqueItems": true
        },
        {
          "$ref": "#/$defs/LocalizedText1000Item"
        }
      ]
    },
    "FTMultiLang": {
      "description": "Multi-lang free text with an unlimited length.",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LocalizedTextItem"
          },
          "uniqueItems": true
        },
        {
          "$ref": "#/$defs/LocalizedTextItem"
        }
      ]
    },
    "AnyXmlElement": {
      "description": "JSON representation of an arbitrary XML element payload.",
      "anyOf": [
        {
          "type": "null"
        },
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/AnyXmlElement"
          }
        },
        {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/AnyXmlElement"
          }
        }
      ]
    },
    "CommonOther": {
      "description": "ILCD common:other extension container. The container must include at least one non-common extension element; namespace declarations are allowed but do not count as extension content.",
      "type": "object",
      "patternProperties": {
        "^@xmlns(:[A-Za-z_][A-Za-z0-9_.-]*)?$": {
          "type": "string"
        },
        "^(?!(common|xmlns):)([A-Za-z_][A-Za-z0-9_.-]*:)?[A-Za-z_][A-Za-z0-9_.-]*$": {
          "$ref": "#/$defs/AnyXmlElement"
        }
      },
      "additionalProperties": false,
      "not": {
        "propertyNames": {
          "pattern": "^@xmlns(:[A-Za-z_][A-Za-z0-9_.-]*)?$"
        }
      }
    },
    "GlobalReferenceType": {
      "description": "Represents a reference to another dataset or file. In TIDAS, references must include type, refObjectId, version, uri, and shortDescription.",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "@type": {
              "$ref": "#/$defs/GlobalReferenceTypeValues"
            },
            "@refObjectId": {
              "type": "string",
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "@version": {
              "$ref": "#/$defs/Version"
            },
            "@uri": {
              "type": "string"
            },
            "common:shortDescription": {
              "$ref": "#/$defs/STMultiLang"
            },
            "common:subReference": {
              "description": "Optional sub-reference (e.g. section or page) within the referenced source.",
              "anyOf": [
                {
                  "$ref": "#/$defs/String"
                },
                {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "$ref": "#/$defs/String"
                  }
                }
              ]
            }
          },
          "required": [
            "@type",
            "@refObjectId",
            "@uri",
            "@version",
            "common:shortDescription"
          ]
        },
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "@type": {
                "$ref": "#/$defs/GlobalReferenceTypeValues"
              },
              "@refObjectId": {
                "type": "string",
                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
              },
              "@version": {
                "$ref": "#/$defs/Version"
              },
              "@uri": {
                "type": "string"
              },
              "common:shortDescription": {
                "$ref": "#/$defs/STMultiLang"
              },
              "common:subReference": {
                "description": "Optional sub-reference (e.g. section or page) within the referenced source.",
                "anyOf": [
                  {
                    "$ref": "#/$defs/String"
                  },
                  {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "$ref": "#/$defs/String"
                    }
                  }
                ]
              }
            },
            "required": [
              "@type",
              "@refObjectId",
              "@uri",
              "@version",
              "common:shortDescription"
            ]
          }
        }
      ]
    },
    "GIS": {
      "description": "Global geographical reference in Latitude and LongitudeExamples: \"+42.42;-180\", \"0;0\", \"13.22 ; -3\"",
      "type": "string",
      "pattern": "^\\s*[+-]?((90(\\.0+)?)|([0-8]?\\d(\\.\\d+)?))\\s*;\\s*[+-]?((180(\\.0+)?)|((1[0-7]\\d|[0-9]?\\d)(\\.\\d+)?))\\s*$"
    },
    "UUID": {
      "description": "Unique Universal Identifier, 16-byte hex number",
      "type": "string",
      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    },
    "Version": {
      "description": "Data set version number, format NN.NN(.NNN) per ILCD.",
      "type": "string",
      "pattern": "^\\d{2}\\.\\d{2}(\\.\\d{3})?$"
    },
    "GlobalReferenceTypeValues": {
      "description": "Type of the referenced dataset/file (ILCD GlobalReferenceTypeValues).",
      "type": "string",
      "enum": [
        "source data set",
        "process data set",
        "flow data set",
        "flow property data set",
        "unit group data set",
        "contact data set",
        "LCIA method data set",
        "other external file"
      ]
    },
    "Year": {
      "description": "4-digit year",
      "type": "integer",
      "minimum": 1000,
      "maximum": 9999
    },
    "dateTime": {
      "description": "Date and time format acc. to ISO 8601",
      "type": "string",
      "format": "date-time"
    }
  }
}
