{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.2/elements/provision.schema.json",
  "$comment": "OpenEik 0.2: folded by tools/fold-schemas.mjs from the proposal provision, which 0.2 makes a rule (decision D5). Written by hand from the text, not generated.",
  "title": "provision element",
  "description": "An element record of category \"provision\" (Part II, 6.10: a void that a run asks of an element it crosses, its host, which the host's owner answers. Its profile is one point, its centre in plan, at its level's elevation plus its offset; width and height are its size across its axis, a round one's width its diameter. In 0.1's layout its folder is architecture.",
  "allOf": [
    {
      "$ref": "element.schema.json"
    },
    {
      "properties": {
        "category": {
          "const": "provision"
        },
        "bars": false,
        "base": false,
        "bottomPlate": false,
        "cable": false,
        "connection": false,
        "edgeAttachments": false,
        "edges": false,
        "electrical": false,
        "end": false,
        "endRise": false,
        "framingCorners": false,
        "framingJoints": false,
        "framingOffset": false,
        "framingStart": false,
        "framingStuds": false,
        "framingTees": false,
        "framingTop": false,
        "generic": false,
        "grading": false,
        "joins": false,
        "joints": false,
        "mep": false,
        "panels": false,
        "propertyLine": false,
        "provision": {
          "description": "The void it asks of its host (Part II, 6.10).",
          "type": "object",
          "properties": {
            "hostId": {
              "type": "string",
              "minLength": 1,
              "x-eik-ref": "element",
              "description": "The element it goes through: a wall, a slab, a foundation, a ceiling, a roof, a beam or a column (rule 3)."
            },
            "axis": {
              "type": "array",
              "minItems": 3,
              "maxItems": 3,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "items": false,
              "description": "A unit vector: the way it runs through its host (rule 1)."
            },
            "up": {
              "type": "array",
              "minItems": 3,
              "maxItems": 3,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "items": false,
              "description": "A unit vector square to axis: the way its height is measured (rule 1)."
            },
            "depth": {
              "description": "Its length along its axis, half each way from its centre, mm (rule 2).",
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 20000
            },
            "round": {
              "description": "true for a round void of diameter width; absent or false, a rectangle (rule 2).",
              "type": "boolean"
            },
            "forIds": {
              "description": "The runs it is for: pipes, ducts and cable carriers (rule 4).",
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "x-eik-ref": "element"
              },
              "minItems": 1,
              "maxItems": 20
            },
            "clearance": {
              "description": "The space kept round its runs on each side, which its size includes, mm.",
              "type": "number",
              "minimum": 0,
              "maximum": 1000
            },
            "note": {
              "description": "What it is for, in words for people.",
              "type": "string",
              "maxLength": 400
            },
            "answer": {
              "description": "Its host's owner's answer (rule 5); absent, it waits for one.",
              "type": "object",
              "properties": {
                "state": {
                  "description": "cut: the void is made; declined: it is not.",
                  "enum": [
                    "cut",
                    "declined"
                  ]
                },
                "by": {
                  "description": "Who answered, as the project names them.",
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "discipline": {
                  "description": "The discipline they answered for (Part XVI, 2, rule 4).",
                  "enum": [
                    "architecture",
                    "structure",
                    "ventilation",
                    "plumbing",
                    "electrical",
                    "sprinkler",
                    "site",
                    "setup"
                  ]
                },
                "at": {
                  "description": "When, an RFC 3339 date and time in UTC.",
                  "type": "string",
                  "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?Z$"
                },
                "text": {
                  "description": "Why, in a sentence: required where it is declined.",
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                },
                "cut": {
                  "description": "What the cut made: a recess of its host's recesses, or an element, each by its id. Required where it is cut.",
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 20,
                  "items": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "recess": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "recess"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "element": {
                            "type": "string",
                            "minLength": 1,
                            "x-eik-ref": "element"
                          }
                        },
                        "required": [
                          "element"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                }
              },
              "required": [
                "state",
                "by",
                "at"
              ],
              "allOf": [
                {
                  "if": {
                    "properties": {
                      "state": {
                        "const": "cut"
                      }
                    },
                    "required": [
                      "state"
                    ]
                  },
                  "then": {
                    "required": [
                      "cut"
                    ]
                  }
                },
                {
                  "if": {
                    "properties": {
                      "state": {
                        "const": "declined"
                      }
                    },
                    "required": [
                      "state"
                    ]
                  },
                  "then": {
                    "required": [
                      "text"
                    ],
                    "properties": {
                      "cut": false
                    }
                  }
                }
              ],
              "x-eik-closed": true
            }
          },
          "required": [
            "hostId",
            "axis",
            "up",
            "depth"
          ],
          "x-eik-closed": true
        },
        "railing": false,
        "roll": false,
        "roof": false,
        "room": false,
        "roomBounding": false,
        "sheet": false,
        "stair": false,
        "taper": false,
        "terminal": false,
        "terrain": false,
        "top": false,
        "turn": false,
        "wallOutline": false
      },
      "required": [
        "provision"
      ]
    },
    {
      "properties": {
        "profile": {
          "maxItems": 1
        }
      }
    },
    {
      "properties": {
        "declaredGeometry": {
          "properties": {
            "envelope": {
              "items": {
                "not": {
                  "required": [
                    "kind"
                  ],
                  "properties": {
                    "kind": {
                      "const": "swept"
                    }
                  }
                }
              }
            },
            "clearances": {
              "items": {
                "properties": {
                  "body": {
                    "not": {
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "const": "swept"
                        }
                      }
                    }
                  }
                }
              }
            },
            "parts": {
              "items": {
                "properties": {
                  "bodies": {
                    "items": {
                      "not": {
                        "required": [
                          "kind"
                        ],
                        "properties": {
                          "kind": {
                            "const": "swept"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    {
      "properties": {
        "declaredGeometry": {
          "properties": {
            "frame": {
              "not": {
                "const": "line"
              }
            }
          }
        }
      }
    }
  ]
}
