{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.2/commands/index.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": "Command",
  "description": "A command of the core record operations (Part V, 2.1), view.upsert of the documentation profile (Part V, 2.2), or of the kinds a part adds (Part XIII, 9), checked against the schema of its kind. x-eik-commands lists the kinds, their schemas and their preconditions (the member, and whether it is required, optional, required when the record exists, or none).",
  "type": "object",
  "properties": {
    "kind": {
      "enum": [
        "create",
        "update",
        "delete",
        "type.upsert",
        "type.delete",
        "type.duplicate",
        "level.upsert",
        "level.delete",
        "material.upsert",
        "grid.upsert",
        "project.rename",
        "project.elevationOffset",
        "project.site",
        "project.envelope",
        "rooms.settings",
        "project.information",
        "project.excavation",
        "project.precast",
        "project.standards",
        "original.make",
        "original.add",
        "original.remove",
        "original.rename",
        "original.dissolve",
        "original.frame",
        "original.edit",
        "copy.place",
        "copy.move",
        "copy.remove",
        "copy.unique",
        "view.upsert",
        "circuit.upsert",
        "circuit.delete",
        "view.lighting"
      ]
    }
  },
  "required": [
    "kind"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "kind": {
            "const": "create"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "create.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "update"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "update.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "delete"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "delete.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "type.upsert"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "type.upsert.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "type.delete"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "type.delete.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "type.duplicate"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "type.duplicate.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "level.upsert"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "level.upsert.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "level.delete"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "level.delete.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "material.upsert"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "material.upsert.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "grid.upsert"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "grid.upsert.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "project.rename"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "project.rename.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "project.elevationOffset"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "project.elevationOffset.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "project.site"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "project.site.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "project.envelope"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "project.envelope.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "rooms.settings"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "rooms.settings.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "project.information"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "project.information.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "project.excavation"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "project.excavation.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "project.precast"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "project.precast.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "project.standards"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "project.standards.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "original.make"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "original.make.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "original.add"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "original.add.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "original.remove"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "original.remove.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "original.rename"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "original.rename.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "original.dissolve"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "original.dissolve.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "original.frame"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "original.frame.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "original.edit"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "original.edit.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "copy.place"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "copy.place.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "copy.move"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "copy.move.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "copy.remove"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "copy.remove.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "copy.unique"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "copy.unique.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "view.upsert"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "view.upsert.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "circuit.upsert"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "circuit.upsert.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "circuit.delete"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "circuit.delete.schema.json"
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "view.lighting"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "view.lighting.schema.json"
      }
    }
  ],
  "x-eik-commands": [
    {
      "kind": "create",
      "schema": "commands/create.schema.json",
      "precondition": "expectedHostRevision",
      "required": "optional"
    },
    {
      "kind": "update",
      "schema": "commands/update.schema.json",
      "precondition": "expectedRevision",
      "required": "required"
    },
    {
      "kind": "delete",
      "schema": "commands/delete.schema.json",
      "precondition": "expectedRevision",
      "required": "required"
    },
    {
      "kind": "type.upsert",
      "schema": "commands/type.upsert.schema.json",
      "precondition": "expectedRevision",
      "required": "optional"
    },
    {
      "kind": "type.delete",
      "schema": "commands/type.delete.schema.json",
      "precondition": "expectedRevision",
      "required": "required"
    },
    {
      "kind": "type.duplicate",
      "schema": "commands/type.duplicate.schema.json",
      "precondition": "expectedSourceRevision",
      "required": "required"
    },
    {
      "kind": "level.upsert",
      "schema": "commands/level.upsert.schema.json",
      "precondition": "expectedLevel",
      "required": "optional"
    },
    {
      "kind": "level.delete",
      "schema": "commands/level.delete.schema.json",
      "precondition": "expectedLevel",
      "required": "required"
    },
    {
      "kind": "material.upsert",
      "schema": "commands/material.upsert.schema.json",
      "precondition": "expectedRevision",
      "required": "optional"
    },
    {
      "kind": "grid.upsert",
      "schema": "commands/grid.upsert.schema.json",
      "precondition": "expectedRevision",
      "required": "when the record exists"
    },
    {
      "kind": "project.rename",
      "schema": "commands/project.rename.schema.json",
      "precondition": "expectedName",
      "required": "required"
    },
    {
      "kind": "project.elevationOffset",
      "schema": "commands/project.elevationOffset.schema.json",
      "precondition": "expectedOffset",
      "required": "required"
    },
    {
      "kind": "project.site",
      "schema": "commands/project.site.schema.json",
      "precondition": "expectedSite",
      "required": "optional"
    },
    {
      "kind": "project.envelope",
      "schema": "commands/project.envelope.schema.json",
      "precondition": "expectedEnvelope",
      "required": "optional"
    },
    {
      "kind": "rooms.settings",
      "schema": "commands/rooms.settings.schema.json",
      "precondition": "expectedSettings",
      "required": "optional"
    },
    {
      "kind": "project.information",
      "schema": "commands/project.information.schema.json",
      "precondition": "expectedInformation",
      "required": "optional"
    },
    {
      "kind": "project.excavation",
      "schema": "commands/project.excavation.schema.json",
      "precondition": null,
      "required": "none"
    },
    {
      "kind": "project.precast",
      "schema": "commands/project.precast.schema.json",
      "precondition": null,
      "required": "none"
    },
    {
      "kind": "project.standards",
      "schema": "commands/project.standards.schema.json",
      "precondition": null,
      "required": "none"
    },
    {
      "kind": "original.make",
      "schema": "commands/original.make.schema.json",
      "precondition": null,
      "required": "none"
    },
    {
      "kind": "original.add",
      "schema": "commands/original.add.schema.json",
      "precondition": "expectedRevision",
      "required": "required"
    },
    {
      "kind": "original.remove",
      "schema": "commands/original.remove.schema.json",
      "precondition": "expectedRevision",
      "required": "required"
    },
    {
      "kind": "original.rename",
      "schema": "commands/original.rename.schema.json",
      "precondition": "expectedRevision",
      "required": "required"
    },
    {
      "kind": "original.dissolve",
      "schema": "commands/original.dissolve.schema.json",
      "precondition": "expectedRevision",
      "required": "required"
    },
    {
      "kind": "original.frame",
      "schema": "commands/original.frame.schema.json",
      "precondition": null,
      "required": "none"
    },
    {
      "kind": "original.edit",
      "schema": "commands/original.edit.schema.json",
      "precondition": null,
      "required": "none"
    },
    {
      "kind": "copy.place",
      "schema": "commands/copy.place.schema.json",
      "precondition": null,
      "required": "none"
    },
    {
      "kind": "copy.move",
      "schema": "commands/copy.move.schema.json",
      "precondition": "expectedRevision",
      "required": "required"
    },
    {
      "kind": "copy.remove",
      "schema": "commands/copy.remove.schema.json",
      "precondition": "expectedRevision",
      "required": "required"
    },
    {
      "kind": "copy.unique",
      "schema": "commands/copy.unique.schema.json",
      "precondition": "expectedRevision",
      "required": "required"
    },
    {
      "kind": "view.upsert",
      "schema": "commands/view.upsert.schema.json",
      "precondition": "expectedRevision",
      "required": "optional"
    },
    {
      "kind": "circuit.upsert",
      "schema": "commands/circuit.upsert.schema.json",
      "precondition": "expectedRevision",
      "required": "optional"
    },
    {
      "kind": "circuit.delete",
      "schema": "commands/circuit.delete.schema.json",
      "precondition": "expectedRevision",
      "required": "optional"
    },
    {
      "kind": "view.lighting",
      "schema": "commands/view.lighting.schema.json",
      "precondition": "expectedRevision",
      "required": "required"
    }
  ]
}
