{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.2/project/material.schema.json",
  "title": "Material",
  "description": "A material of the project's material library.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,60}$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "color": {
      "type": "string",
      "pattern": "^#[0-9a-fA-F]{6}$"
    },
    "pattern": {
      "type": "string",
      "enum": [
        "none",
        "solid",
        "concrete",
        "gravel",
        "soil",
        "rigid",
        "soft",
        "timber",
        "diagonal",
        "cross",
        "clt"
      ]
    },
    "lambda": {
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 1000
    },
    "surface": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "brick"
            },
            "unit": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "prefixItems": [
                {
                  "type": "number",
                  "minimum": 20,
                  "maximum": 2000
                },
                {
                  "type": "number",
                  "minimum": 20,
                  "maximum": 1000
                }
              ]
            },
            "joint": {
              "type": "number",
              "minimum": 0,
              "maximum": 50
            },
            "bond": {
              "type": "string",
              "enum": [
                "running",
                "stack"
              ]
            },
            "offset": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "prefixItems": [
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                },
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                }
              ]
            }
          },
          "required": [
            "kind",
            "unit",
            "joint",
            "bond"
          ],
          "x-eik-closed": true
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "boards"
            },
            "direction": {
              "type": "string",
              "enum": [
                "vertical",
                "horizontal"
              ]
            },
            "width": {
              "type": "number",
              "minimum": 20,
              "maximum": 2000
            },
            "cover": {
              "type": "object",
              "properties": {
                "width": {
                  "type": "number",
                  "minimum": 10,
                  "maximum": 500
                },
                "at": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 2000
                }
              },
              "required": [
                "width"
              ],
              "x-eik-closed": true
            },
            "offset": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "prefixItems": [
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                },
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                }
              ]
            }
          },
          "required": [
            "kind",
            "direction",
            "width"
          ],
          "x-eik-closed": true
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "panels"
            },
            "width": {
              "type": "number",
              "minimum": 100,
              "maximum": 10000
            },
            "height": {
              "type": "number",
              "minimum": 100,
              "maximum": 10000
            },
            "offset": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "prefixItems": [
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                },
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                }
              ]
            }
          },
          "required": [
            "kind",
            "width",
            "height"
          ],
          "x-eik-closed": true
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "tiles"
            },
            "row": {
              "type": "number",
              "minimum": 50,
              "maximum": 1000
            },
            "width": {
              "type": "number",
              "minimum": 50,
              "maximum": 1000
            },
            "profile": {
              "type": "string",
              "enum": [
                "flat",
                "pan"
              ]
            },
            "offset": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "prefixItems": [
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                },
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                }
              ]
            }
          },
          "required": [
            "kind",
            "row",
            "width",
            "profile"
          ],
          "x-eik-closed": true
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "seams"
            },
            "spacing": {
              "type": "number",
              "minimum": 100,
              "maximum": 3000
            },
            "fold": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            },
            "offset": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "prefixItems": [
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                },
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                }
              ]
            }
          },
          "required": [
            "kind",
            "spacing"
          ],
          "x-eik-closed": true
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "ribs"
            },
            "spacing": {
              "type": "number",
              "minimum": 50,
              "maximum": 1000
            },
            "offset": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "prefixItems": [
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                },
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                }
              ]
            }
          },
          "required": [
            "kind",
            "spacing"
          ],
          "x-eik-closed": true
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "strips"
            },
            "spacing": {
              "type": "number",
              "minimum": 100,
              "maximum": 5000
            },
            "offset": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "prefixItems": [
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                },
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                }
              ]
            }
          },
          "required": [
            "kind",
            "spacing"
          ],
          "x-eik-closed": true
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "stipple"
            },
            "density": {
              "type": "number",
              "minimum": 1,
              "maximum": 100
            },
            "offset": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "prefixItems": [
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                },
                {
                  "type": "number",
                  "minimum": -100000,
                  "maximum": 100000
                }
              ]
            }
          },
          "required": [
            "kind",
            "density"
          ],
          "x-eik-closed": true
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "none"
            }
          },
          "required": [
            "kind"
          ],
          "x-eik-closed": true
        }
      ]
    },
    "density": {
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 30000
    },
    "specificHeat": {
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 20000
    },
    "vapourResistance": {
      "type": "number",
      "minimum": 1,
      "maximum": 1000000000
    },
    "solarAbsorptance": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "emissivity": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "lightReflectance": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "criticalMoisture": {
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 100
    },
    "fireReaction": {
      "type": "string",
      "minLength": 1,
      "maxLength": 24
    },
    "strengthClass": {
      "type": "string",
      "minLength": 1,
      "maxLength": 24
    },
    "climate": {
      "type": "object",
      "properties": {
        "gwpA1A3": {
          "type": "number",
          "minimum": -1000000,
          "maximum": 1000000
        },
        "unit": {
          "type": "string",
          "enum": [
            "kg",
            "m3",
            "m2",
            "m",
            "piece"
          ]
        },
        "source": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "required": [
        "gwpA1A3",
        "unit"
      ],
      "x-eik-closed": true
    },
    "revision": {
      "type": "integer",
      "minimum": 0
    },
    "classifications": {
      "$ref": "../classifications/classifications.schema.json"
    }
  },
  "required": [
    "id",
    "name",
    "color",
    "pattern",
    "revision"
  ],
  "x-eik-closed": true
}
