{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://specify.digital/schemas/specify-house-model/1/house.schema.json",
  "title": "Specify house model manifest, version 1",
  "description": "house.json in a delivered house package. See docs/contracts/house-model/README.md, sections A2 and A3. Rules this schema cannot express (that default is one of options, that empty options exist, the 64-combination limit, that every layout combination has a plan) are checked by the conformance check and numbered HM-3 to HM-6 there.",
  "type": "object",
  "additionalProperties": false,
  "required": ["standard", "house", "name", "groups", "rooms"],
  "$defs": {
    "key": {
      "description": "HM-7. The same characters Specify's configurator uses for row and option keys.",
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9_-]*$",
      "maxLength": 64
    },
    "label": {
      "description": "Text a customer reads.",
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "group": {
      "type": "object",
      "additionalProperties": false,
      "required": ["key", "kind", "default", "options"],
      "properties": {
        "key": { "$ref": "#/$defs/key" },
        "kind": {
          "description": "geometry: options are parts shown or hidden (A4). material: options are KHR_materials_variants variants (A6).",
          "enum": ["geometry", "material"]
        },
        "layout": {
          "description": "HM-5. True for a geometry group whose options change the floor plan. Only meaningful on geometry groups.",
          "type": "boolean"
        },
        "default": { "$ref": "#/$defs/key" },
        "options": {
          "type": "array",
          "items": { "$ref": "#/$defs/key" },
          "minItems": 1,
          "uniqueItems": true
        },
        "empty": {
          "description": "HM-4. Geometry options that are allowed to show no parts, such as garage: no.",
          "type": "array",
          "items": { "$ref": "#/$defs/key" },
          "uniqueItems": true
        }
      }
    }
  },
  "properties": {
    "standard": { "const": "specify-house-model/1" },
    "house": { "$ref": "#/$defs/key" },
    "name": { "$ref": "#/$defs/label" },
    "groups": {
      "type": "array",
      "items": { "$ref": "#/$defs/group" },
      "minItems": 1
    },
    "rooms": {
      "description": "HM-19. Every room:<key> node in the interior, with the name a customer reads.",
      "type": "object",
      "minProperties": 1,
      "propertyNames": { "$ref": "#/$defs/key" },
      "additionalProperties": { "$ref": "#/$defs/label" }
    },
    "views": {
      "description": "HM-28. Every view:<key> node, with the name a customer reads. Optional.",
      "type": "object",
      "propertyNames": { "$ref": "#/$defs/key" },
      "additionalProperties": { "$ref": "#/$defs/label" }
    }
  }
}
