{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.6/commands/run.join.schema.json",
  "$comment": "OpenEik 0.6: folded by tools/fold-schemas-0.6.mjs from the proposal systems, which 0.6 makes a rule (open questions, 145). Written by hand, not generated.",
  "title": "run.join",
  "description": "Joins a pipe's or a duct's end to a terminal's port, its record's mep.joins (Part II, 6.9.1, rule 5), or with terminalId null takes its join away, with no port and no place; with place, it also moves the end to the port's place, its point in plan and its height. Run as an update of the run.",
  "type": "object",
  "properties": {
    "kind": {
      "const": "run.join"
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "x-eik-ref": "element",
      "description": "The pipe or the duct."
    },
    "expectedRevision": {
      "type": "integer",
      "minimum": 0,
      "description": "The run's revision as read."
    },
    "end": {
      "type": "string",
      "enum": [
        "start",
        "end"
      ],
      "description": "The run's end: its profile's first point, or its last."
    },
    "terminalId": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "x-eik-ref": "element"
        },
        {
          "type": "null"
        }
      ],
      "description": "The terminal whose port the end joins; null takes the end's join away."
    },
    "port": {
      "type": "integer",
      "minimum": 0,
      "maximum": 103,
      "description": "The port, by its index among the terminal's, 0 to 103 (Part II, 6.9.1, rule 3); with a terminalId, required, and with terminalId null, refused."
    },
    "place": {
      "type": "boolean",
      "description": "Move the end to the port's place: its profile's point to the port's in plan, and its height in mep.z to the port's above the run's level; false where it is left out, and true refused with terminalId null, which names no port to move to."
    }
  },
  "required": [
    "kind",
    "id",
    "expectedRevision",
    "end",
    "terminalId"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "terminalId": {
            "type": "null"
          }
        },
        "required": [
          "terminalId"
        ]
      },
      "then": {
        "properties": {
          "port": false,
          "place": {
            "const": false
          }
        }
      }
    }
  ],
  "additionalProperties": false
}
