{
  "$id": "https://cdn.jsdelivr.net/npm/@accurona/core@0/schema/scene-v2.json",
  "title": "Accurona scene, version 2",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "maxLength": 2000
    },
    "format": {
      "type": "string",
      "const": "accurona-scene"
    },
    "version": {
      "type": "number",
      "const": 2
    },
    "id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,64}$"
    },
    "title": {
      "type": "string",
      "maxLength": 100
    },
    "description": {
      "type": "string",
      "maxLength": 1000
    },
    "units": {
      "type": "string",
      "enum": [
        "mm",
        "cm",
        "m",
        "in",
        "ft-in"
      ]
    },
    "objects": {
      "maxItems": 10000,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "element": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "icon": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          },
          "tags": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          },
          "props": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 1000
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "ports": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]{1,64}$"
                },
                "name": {
                  "type": "string",
                  "maxLength": 100
                },
                "kind": {
                  "type": "string",
                  "maxLength": 100
                },
                "props": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "additionalProperties": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      }
                    ]
                  }
                },
                "links": {
                  "maxItems": 20,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string",
                        "pattern": "^[a-z0-9][a-z0-9._-]{0,39}$"
                      },
                      "ref": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "url": {
                        "type": "string",
                        "maxLength": 2000
                      },
                      "label": {
                        "type": "string",
                        "maxLength": 100
                      }
                    },
                    "required": [
                      "source"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "id"
              ],
              "additionalProperties": false
            }
          },
          "links": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "source": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9._-]{0,39}$"
                },
                "ref": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "url": {
                  "type": "string",
                  "maxLength": 2000
                },
                "label": {
                  "type": "string",
                  "maxLength": 100
                }
              },
              "required": [
                "source"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false
      }
    },
    "connections": {
      "maxItems": 10000,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "from": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "fromPort": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "to": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "toPort": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "kind": {
            "type": "string",
            "maxLength": 100
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          },
          "props": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 1000
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "links": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "source": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9._-]{0,39}$"
                },
                "ref": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "url": {
                  "type": "string",
                  "maxLength": 2000
                },
                "label": {
                  "type": "string",
                  "maxLength": 100
                }
              },
              "required": [
                "source"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "from",
          "to"
        ],
        "additionalProperties": false
      }
    },
    "views": {
      "maxItems": 1000,
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,64}$"
              },
              "name": {
                "type": "string",
                "maxLength": 100
              },
              "description": {
                "type": "string",
                "maxLength": 1000
              },
              "lastUpdated": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "const": "plan"
              },
              "floors": {
                "maxItems": 200,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 100
                    },
                    "elevationMm": {
                      "type": "number",
                      "minimum": -10000000,
                      "maximum": 10000000
                    },
                    "wallHeightMm": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 10000000
                    },
                    "nodes": {
                      "maxItems": 10000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                          },
                          "x": {
                            "type": "number",
                            "minimum": -10000000,
                            "maximum": 10000000
                          },
                          "y": {
                            "type": "number",
                            "minimum": -10000000,
                            "maximum": 10000000
                          }
                        },
                        "required": [
                          "id",
                          "x",
                          "y"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "walls": {
                      "maxItems": 10000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                          },
                          "from": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                          },
                          "to": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                          },
                          "exterior": {
                            "type": "boolean"
                          },
                          "layer": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                          }
                        },
                        "required": [
                          "id",
                          "from",
                          "to"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                }
              },
              "placements": {
                "maxItems": 10000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "floor": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "x": {
                      "type": "number",
                      "minimum": -10000000,
                      "maximum": 10000000
                    },
                    "y": {
                      "type": "number",
                      "minimum": -10000000,
                      "maximum": 10000000
                    },
                    "rotation": {
                      "type": "number",
                      "minimum": -360000,
                      "maximum": 360000
                    },
                    "mirror": {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "boolean"
                        },
                        "y": {
                          "type": "boolean"
                        },
                        "z": {
                          "type": "boolean"
                        }
                      },
                      "additionalProperties": false
                    },
                    "mountFrom": {
                      "type": "string",
                      "enum": [
                        "floor",
                        "ceiling",
                        "surface"
                      ]
                    },
                    "mountMm": {
                      "type": "number",
                      "minimum": -10000000,
                      "maximum": 10000000
                    },
                    "mountOn": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "size": {
                      "type": "object",
                      "properties": {
                        "w": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 10000000
                        },
                        "d": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 10000000
                        },
                        "h": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 10000000
                        }
                      },
                      "additionalProperties": false
                    },
                    "attach": {
                      "type": "object",
                      "properties": {
                        "wall": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_-]{1,64}$"
                        }
                      },
                      "required": [
                        "wall"
                      ],
                      "additionalProperties": false
                    },
                    "layer": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "symbol": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "floor",
                    "x",
                    "y"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "name",
              "kind",
              "floors"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,64}$"
              },
              "name": {
                "type": "string",
                "maxLength": 100
              },
              "description": {
                "type": "string",
                "maxLength": 1000
              },
              "lastUpdated": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "iso",
                  "schematic"
                ]
              },
              "placements": {
                "maxItems": 10000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "tile": {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "integer",
                          "minimum": -1000,
                          "maximum": 1000
                        },
                        "y": {
                          "type": "integer",
                          "minimum": -1000,
                          "maximum": 1000
                        }
                      },
                      "required": [
                        "x",
                        "y"
                      ],
                      "additionalProperties": false
                    },
                    "labelHeight": {
                      "type": "number",
                      "minimum": -1000,
                      "maximum": 1000
                    },
                    "group": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "layer": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "locked": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "tile"
                  ],
                  "additionalProperties": false
                }
              },
              "connectors": {
                "maxItems": 5000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "connection": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "anchors": {
                      "minItems": 2,
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,64}$"
                          },
                          "ref": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "object": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z0-9_-]{1,64}$"
                                  },
                                  "side": {
                                    "type": "string",
                                    "enum": [
                                      "+X",
                                      "-X",
                                      "+Y",
                                      "-Y"
                                    ]
                                  }
                                },
                                "required": [
                                  "object"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "anchor": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z0-9_-]{1,64}$"
                                  }
                                },
                                "required": [
                                  "anchor"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "tile": {
                                    "type": "object",
                                    "properties": {
                                      "x": {
                                        "type": "integer",
                                        "minimum": -1000,
                                        "maximum": 1000
                                      },
                                      "y": {
                                        "type": "integer",
                                        "minimum": -1000,
                                        "maximum": 1000
                                      }
                                    },
                                    "required": [
                                      "x",
                                      "y"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "tile"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "ref"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 1000
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "width": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1000
                    },
                    "style": {
                      "type": "string",
                      "enum": [
                        "SOLID",
                        "DOTTED",
                        "DASHED"
                      ]
                    },
                    "direction": {
                      "type": "string",
                      "enum": [
                        "START_TO_END",
                        "END_TO_START",
                        "BOTH",
                        "NONE"
                      ]
                    },
                    "glyph": {
                      "type": "string",
                      "enum": [
                        "triangle",
                        "chevron",
                        "double-chevron",
                        "circle-solid",
                        "circle-outline",
                        "diamond",
                        "square",
                        "dollar",
                        "bolt",
                        "envelope",
                        "person",
                        "star"
                      ]
                    },
                    "animated": {
                      "type": "boolean"
                    },
                    "animationRate": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    "animationFlow": {
                      "type": "string",
                      "enum": [
                        "forward",
                        "reverse",
                        "both"
                      ]
                    },
                    "layer": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "locked": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "anchors"
                  ],
                  "additionalProperties": false
                }
              },
              "rectangles": {
                "maxItems": 5000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "from": {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "integer",
                          "minimum": -1000,
                          "maximum": 1000
                        },
                        "y": {
                          "type": "integer",
                          "minimum": -1000,
                          "maximum": 1000
                        }
                      },
                      "required": [
                        "x",
                        "y"
                      ],
                      "additionalProperties": false
                    },
                    "to": {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "integer",
                          "minimum": -1000,
                          "maximum": 1000
                        },
                        "y": {
                          "type": "integer",
                          "minimum": -1000,
                          "maximum": 1000
                        }
                      },
                      "required": [
                        "x",
                        "y"
                      ],
                      "additionalProperties": false
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "colorValue": {
                      "type": "string",
                      "pattern": "^#[0-9a-fA-F]{6}$"
                    },
                    "outlineColor": {
                      "type": "string",
                      "pattern": "^#[0-9a-fA-F]{6}$"
                    },
                    "transparency": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    "zIndex": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "group": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "layer": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "locked": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "from",
                    "to"
                  ],
                  "additionalProperties": false
                }
              },
              "textBoxes": {
                "maxItems": 5000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "tile": {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "integer",
                          "minimum": -1000,
                          "maximum": 1000
                        },
                        "y": {
                          "type": "integer",
                          "minimum": -1000,
                          "maximum": 1000
                        }
                      },
                      "required": [
                        "x",
                        "y"
                      ],
                      "additionalProperties": false
                    },
                    "content": {
                      "type": "string",
                      "maxLength": 100
                    },
                    "fontSize": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1000
                    },
                    "orientation": {
                      "type": "string",
                      "enum": [
                        "X",
                        "Y"
                      ]
                    },
                    "group": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "layer": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "locked": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "tile",
                    "content"
                  ],
                  "additionalProperties": false
                }
              },
              "groups": {
                "maxItems": 5000,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "name": {
                      "type": "string",
                      "maxLength": 100
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^#[0-9a-fA-F]{6}$"
                    },
                    "group": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,64}$"
                    },
                    "collapsed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "name",
              "kind"
            ],
            "additionalProperties": false
          }
        ]
      }
    },
    "layers": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "visible": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false
      }
    },
    "icons": {
      "maxItems": 5000,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "url": {
            "type": "string",
            "maxLength": 65536
          },
          "collection": {
            "type": "string",
            "maxLength": 100
          },
          "isIsometric": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "url"
        ],
        "additionalProperties": false
      }
    },
    "colors": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "value": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          }
        },
        "required": [
          "id",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "links": {
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9._-]{0,39}$"
          },
          "ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "url": {
            "type": "string",
            "maxLength": 2000
          },
          "label": {
            "type": "string",
            "maxLength": 100
          }
        },
        "required": [
          "source"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "format",
    "version",
    "id",
    "objects"
  ],
  "additionalProperties": false
}
