{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.3/commands/view.lighting.schema.json",
  "$comment": "OpenEik 0.2: folded by tools/fold-schemas.mjs from the proposal electrical, which 0.2 makes a rule (decision D5). Written by hand from the text, not generated.",
  "title": "view.lighting",
  "description": "Switches luminaires on, off or to a level in a 3D view's lighting scene, display.lighting (Part XIII, 9 and 4.3), and writes the view whole, adding 1 to its revision; it changes no element. The luminaires it works on are given by one selector or more: within a selector they are a union, and across selectors an intersection. level is required with set dim, may be given with only, and is not given with on or off. A member the kind does not define is refused, not dropped (Part V, 1.4).",
  "type": "object",
  "properties": {
    "kind": {
      "const": "view.lighting"
    },
    "id": {
      "description": "The view: one of kind 3d (Part XIII, 4.3, rule 1).",
      "type": "string",
      "minLength": 1,
      "x-eik-ref": "view"
    },
    "expectedRevision": {
      "description": "The view's revision as read.",
      "type": "integer",
      "minimum": 0
    },
    "set": {
      "description": "What the command does to the luminaires it selects: on, at full; off; dim, on at level; only, exactly them on, at level where one is given, else at full, and every other luminaire off.",
      "enum": [
        "on",
        "off",
        "dim",
        "only"
      ]
    },
    "level": {
      "description": "The level, in per cent of a luminaire's full light: 100 is full.",
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "ids": {
      "description": "The luminaires of these ids.",
      "$ref": "#/$defs/ids",
      "items": {
        "x-eik-ref": "element"
      }
    },
    "rooms": {
      "description": "The luminaires of these rooms: on the room's level, their at inside its outline in plan and outside its holes.",
      "$ref": "#/$defs/ids",
      "items": {
        "x-eik-ref": "element"
      }
    },
    "switches": {
      "description": "The luminaires that these elements work, switches, dimmers, buttons or sensors: those their electrical.controls names.",
      "$ref": "#/$defs/ids",
      "items": {
        "x-eik-ref": "element"
      }
    },
    "circuits": {
      "description": "The luminaires whose electrical.circuitId is one of these.",
      "$ref": "#/$defs/ids",
      "items": {
        "x-eik-ref": "circuit"
      }
    },
    "levels": {
      "description": "The luminaires whose levelId is one of these.",
      "$ref": "#/$defs/ids",
      "items": {
        "x-eik-ref": "level"
      }
    },
    "kinds": {
      "description": "The luminaires whose type's kind is one of these.",
      "type": "array",
      "items": {
        "enum": [
          "light",
          "spot",
          "emergencyLight",
          "track"
        ]
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "all": {
      "description": "Every luminaire of the model.",
      "const": true
    }
  },
  "required": [
    "kind",
    "id",
    "expectedRevision",
    "set"
  ],
  "anyOf": [
    {
      "required": [
        "ids"
      ]
    },
    {
      "required": [
        "rooms"
      ]
    },
    {
      "required": [
        "switches"
      ]
    },
    {
      "required": [
        "circuits"
      ]
    },
    {
      "required": [
        "levels"
      ]
    },
    {
      "required": [
        "kinds"
      ]
    },
    {
      "required": [
        "all"
      ]
    }
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "set": {
            "const": "dim"
          }
        },
        "required": [
          "set"
        ]
      },
      "then": {
        "required": [
          "level"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "set": {
            "enum": [
              "on",
              "off"
            ]
          }
        },
        "required": [
          "set"
        ]
      },
      "then": {
        "properties": {
          "level": false
        }
      }
    }
  ],
  "additionalProperties": false,
  "$defs": {
    "ids": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "minItems": 1,
      "maxItems": 10000,
      "uniqueItems": true
    }
  }
}
