{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.3/commands/type.upsert.schema.json",
  "$comment": "Written by hand from Part V and the member names of the reference vocabulary; tools/generate-schemas.mjs does not make it yet (schemas/commands/README.md).",
  "title": "type.upsert",
  "description": "Writes a type whole. A new type counts as revision 0 (Part V, 3.2). A member the kind does not define is refused, not dropped (Part V, 1.4).",
  "type": "object",
  "properties": {
    "kind": {
      "const": "type.upsert"
    },
    "type": {
      "type": "object",
      "properties": {
        "category": {
          "enum": [
            "slab",
            "foundation",
            "wall",
            "ceiling",
            "roof",
            "beam",
            "column",
            "door",
            "window",
            "slabEdge",
            "rebar",
            "mesh",
            "component",
            "gutter",
            "room",
            "roomSeparator",
            "shaft",
            "stair",
            "railing",
            "pipe",
            "duct",
            "terminal",
            "terrain",
            "grading",
            "propertyLine",
            "furniture",
            "planting",
            "road",
            "parking",
            "fire",
            "generic",
            "electrical",
            "cableCarrier",
            "cable",
            "member",
            "provision"
          ]
        }
      },
      "required": [
        "category"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "category": {
                "const": "slab"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/slab.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "foundation"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/foundation.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "wall"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/wall.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "ceiling"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/ceiling.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "roof"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/roof.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "beam"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/beam.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "column"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/column.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "door"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/door.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "window"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/window.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "slabEdge"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/slabEdge.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "rebar"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/rebar.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "mesh"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/mesh.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "component"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/component.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "gutter"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/gutter.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "room"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/room.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "roomSeparator"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/roomSeparator.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "shaft"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/shaft.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "stair"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/stair.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "railing"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/railing.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "pipe"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/pipe.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "duct"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/duct.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "terminal"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/terminal.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "terrain"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/terrain.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "grading"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/grading.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "propertyLine"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/propertyLine.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "furniture"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/furniture.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "planting"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/planting.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "road"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/road.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "parking"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/parking.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "fire"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/fire.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "generic"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/generic.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "electrical"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/electrical.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "cableCarrier"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/cableCarrier.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "cable"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/cable.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "member"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/member.schema.json"
          }
        },
        {
          "if": {
            "properties": {
              "category": {
                "const": "provision"
              }
            },
            "required": [
              "category"
            ]
          },
          "then": {
            "$ref": "../types/provision.schema.json"
          }
        }
      ],
      "description": "The type, checked against types/<category>.schema.json."
    },
    "expectedRevision": {
      "type": "integer",
      "minimum": 0
    }
  },
  "required": [
    "kind",
    "type"
  ],
  "additionalProperties": false
}
