{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.2/commands/level.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": "level.upsert",
  "description": "Adds or changes a level; a new level gets its own plan unless plan is false. A member the kind does not define is refused, not dropped (Part V, 1.4).",
  "type": "object",
  "properties": {
    "kind": {
      "const": "level.upsert"
    },
    "level": {
      "$ref": "../project/levels.schema.json#/items",
      "properties": {
        "id": {
          "minLength": 1
        },
        "name": {
          "minLength": 1
        }
      }
    },
    "expectedLevel": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "elevation": {
          "type": "number"
        }
      },
      "required": [
        "id",
        "name",
        "elevation"
      ],
      "description": "The whole level as read: id, name and elevation."
    },
    "plan": {
      "type": "boolean"
    }
  },
  "required": [
    "kind",
    "level"
  ],
  "additionalProperties": false
}
