{
  "$defs": {
    "ArchitecturalNeed": {
      "additionalProperties": false,
      "properties": {
        "reference": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$",
          "title": "Reference",
          "type": "string"
        },
        "kind": {
          "enum": [
            "window",
            "portal",
            "wall-run",
            "open-center",
            "natural-light",
            "ceiling-light"
          ],
          "title": "Kind",
          "type": "string"
        },
        "quantity": {
          "maximum": 16,
          "minimum": 1,
          "title": "Quantity",
          "type": "integer"
        },
        "priority": {
          "enum": [
            "required",
            "recommended",
            "optional"
          ],
          "title": "Priority",
          "type": "string"
        },
        "evidence": {
          "$ref": "#/$defs/ProgramEvidence"
        }
      },
      "required": [
        "reference",
        "kind",
        "quantity",
        "priority",
        "evidence"
      ],
      "title": "ArchitecturalNeed",
      "type": "object"
    },
    "ExplicitProgramEvidence": {
      "additionalProperties": false,
      "properties": {
        "origin": {
          "const": "explicit",
          "title": "Origin",
          "type": "string"
        },
        "confidence": {
          "maximum": 1,
          "minimum": 0,
          "title": "Confidence",
          "type": "number"
        },
        "explanation": {
          "maxLength": 500,
          "minLength": 1,
          "title": "Explanation",
          "type": "string"
        }
      },
      "required": [
        "origin",
        "confidence",
        "explanation"
      ],
      "title": "ExplicitProgramEvidence",
      "type": "object"
    },
    "FunctionalZone": {
      "additionalProperties": false,
      "properties": {
        "reference": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$",
          "title": "Reference",
          "type": "string"
        },
        "purpose": {
          "maxLength": 100,
          "minLength": 1,
          "title": "Purpose",
          "type": "string"
        },
        "priority": {
          "enum": [
            "required",
            "recommended",
            "optional"
          ],
          "title": "Priority",
          "type": "string"
        }
      },
      "required": [
        "reference",
        "purpose",
        "priority"
      ],
      "title": "FunctionalZone",
      "type": "object"
    },
    "ProgramEvidence": {
      "additionalProperties": false,
      "properties": {
        "origin": {
          "enum": [
            "explicit",
            "archetype",
            "inferred"
          ],
          "title": "Origin",
          "type": "string"
        },
        "confidence": {
          "maximum": 1,
          "minimum": 0,
          "title": "Confidence",
          "type": "number"
        },
        "explanation": {
          "maxLength": 500,
          "minLength": 1,
          "title": "Explanation",
          "type": "string"
        }
      },
      "required": [
        "origin",
        "confidence",
        "explanation"
      ],
      "title": "ProgramEvidence",
      "type": "object"
    },
    "ProgramExclusion": {
      "additionalProperties": false,
      "properties": {
        "category": {
          "pattern": "^[a-z][a-z0-9_-]*\\.[a-z][a-z0-9_.-]{0,79}$",
          "title": "Category",
          "type": "string"
        },
        "evidence": {
          "$ref": "#/$defs/ExplicitProgramEvidence"
        }
      },
      "required": [
        "category",
        "evidence"
      ],
      "title": "ProgramExclusion",
      "type": "object"
    },
    "ProgramNeed": {
      "additionalProperties": false,
      "properties": {
        "reference": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$",
          "title": "Reference",
          "type": "string"
        },
        "category": {
          "pattern": "^[a-z][a-z0-9_-]*\\.[a-z][a-z0-9_.-]{0,79}$",
          "title": "Category",
          "type": "string"
        },
        "zone": {
          "maxLength": 80,
          "title": "Zone",
          "type": "string"
        },
        "quantity": {
          "maximum": 64,
          "minimum": 1,
          "title": "Quantity",
          "type": "integer"
        },
        "capacity": {
          "anyOf": [
            {
              "maximum": 64,
              "minimum": 1,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Capacity"
        },
        "priority": {
          "enum": [
            "required",
            "recommended",
            "optional"
          ],
          "title": "Priority",
          "type": "string"
        },
        "assetAlias": {
          "anyOf": [
            {
              "pattern": "^[a-z0-9][a-z0-9_.-]{0,99}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Assetalias"
        },
        "placement": {
          "enum": [
            "auto",
            "center",
            "perimeter"
          ],
          "title": "Placement",
          "type": "string"
        },
        "evidence": {
          "$ref": "#/$defs/ProgramEvidence"
        }
      },
      "required": [
        "reference",
        "category",
        "zone",
        "quantity",
        "capacity",
        "priority",
        "assetAlias",
        "placement",
        "evidence"
      ],
      "title": "ProgramNeed",
      "type": "object"
    },
    "ProgramRule": {
      "additionalProperties": false,
      "properties": {
        "reference": {
          "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,79}$",
          "title": "Reference",
          "type": "string"
        },
        "kind": {
          "enum": [
            "on",
            "seating",
            "beside",
            "facing",
            "near-window",
            "wall-alignment",
            "interior",
            "access",
            "visibility",
            "clearance",
            "circulation",
            "minimum-dimensions",
            "unsupported"
          ],
          "title": "Kind",
          "type": "string"
        },
        "subjects": {
          "items": {
            "type": "string"
          },
          "maxItems": 64,
          "title": "Subjects",
          "type": "array"
        },
        "target": {
          "anyOf": [
            {
              "maxLength": 80,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Target"
        },
        "priority": {
          "enum": [
            "required",
            "recommended",
            "optional"
          ],
          "title": "Priority",
          "type": "string"
        },
        "strength": {
          "enum": [
            "hard",
            "soft"
          ],
          "title": "Strength",
          "type": "string"
        },
        "clearanceM": {
          "anyOf": [
            {
              "maximum": 100,
              "minimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Clearancem"
        },
        "description": {
          "maxLength": 500,
          "minLength": 1,
          "title": "Description",
          "type": "string"
        },
        "evidence": {
          "$ref": "#/$defs/ProgramEvidence"
        }
      },
      "required": [
        "reference",
        "kind",
        "subjects",
        "target",
        "priority",
        "strength",
        "clearanceM",
        "description",
        "evidence"
      ],
      "title": "ProgramRule",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "properties": {
    "version": {
      "const": "qway.room-program/1",
      "title": "Version",
      "type": "string"
    },
    "archetype": {
      "pattern": "^[a-z][a-z0-9_.-]{0,99}$",
      "title": "Archetype",
      "type": "string"
    },
    "archetypeRevision": {
      "maxLength": 100,
      "minLength": 1,
      "title": "Archetyperevision",
      "type": "string"
    },
    "purpose": {
      "pattern": "^[a-z][a-z0-9_.-]{0,99}$",
      "title": "Purpose",
      "type": "string"
    },
    "capacity": {
      "maximum": 64,
      "minimum": 1,
      "title": "Capacity",
      "type": "integer"
    },
    "style": {
      "maxLength": 100,
      "title": "Style",
      "type": "string"
    },
    "zones": {
      "items": {
        "$ref": "#/$defs/FunctionalZone"
      },
      "maxItems": 32,
      "minItems": 1,
      "title": "Zones",
      "type": "array"
    },
    "needs": {
      "items": {
        "$ref": "#/$defs/ProgramNeed"
      },
      "maxItems": 64,
      "title": "Needs",
      "type": "array"
    },
    "rules": {
      "items": {
        "$ref": "#/$defs/ProgramRule"
      },
      "maxItems": 128,
      "title": "Rules",
      "type": "array"
    },
    "architecture": {
      "items": {
        "$ref": "#/$defs/ArchitecturalNeed"
      },
      "maxItems": 32,
      "title": "Architecture",
      "type": "array"
    },
    "exclusions": {
      "items": {
        "$ref": "#/$defs/ProgramExclusion"
      },
      "maxItems": 64,
      "title": "Exclusions",
      "type": "array"
    },
    "uncertainties": {
      "items": {
        "type": "string"
      },
      "maxItems": 32,
      "title": "Uncertainties",
      "type": "array"
    }
  },
  "required": [
    "version",
    "archetype",
    "archetypeRevision",
    "purpose",
    "capacity",
    "style",
    "zones",
    "needs",
    "rules",
    "architecture",
    "exclusions",
    "uncertainties"
  ],
  "title": "RoomProgram",
  "type": "object",
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
