{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schema": {
      "const": "quay.archetype",
      "type": "string"
    },
    "schemaVersion": {
      "const": "1.0.0",
      "type": "string"
    },
    "profileId": {
      "type": "string"
    },
    "revision": {
      "type": "number"
    },
    "parentId": {
      "anyOf": [
        {
          "type": "null"
        },
        {
          "type": "string"
        }
      ]
    },
    "semanticClass": {
      "type": "string"
    },
    "status": {
      "anyOf": [
        {
          "const": "suggested",
          "type": "string"
        },
        {
          "const": "accepted",
          "type": "string"
        },
        {
          "const": "rejected",
          "type": "string"
        },
        {
          "const": "user-corrected",
          "type": "string"
        }
      ]
    },
    "dimensions": {
      "type": "object",
      "properties": {
        "width": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "properties": {
                "minM": {
                  "type": "number"
                },
                "typicalM": {
                  "type": "number"
                },
                "maxM": {
                  "type": "number"
                },
                "reference": {
                  "anyOf": [
                    {
                      "const": "whole-bounds",
                      "type": "string"
                    },
                    {
                      "const": "withers",
                      "type": "string"
                    },
                    {
                      "const": "seat",
                      "type": "string"
                    },
                    {
                      "const": "worktop",
                      "type": "string"
                    },
                    {
                      "const": "opening",
                      "type": "string"
                    }
                  ]
                }
              },
              "required": ["minM", "typicalM", "maxM", "reference"],
              "additionalProperties": false
            }
          ]
        },
        "height": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "properties": {
                "minM": {
                  "type": "number"
                },
                "typicalM": {
                  "type": "number"
                },
                "maxM": {
                  "type": "number"
                },
                "reference": {
                  "anyOf": [
                    {
                      "const": "whole-bounds",
                      "type": "string"
                    },
                    {
                      "const": "withers",
                      "type": "string"
                    },
                    {
                      "const": "seat",
                      "type": "string"
                    },
                    {
                      "const": "worktop",
                      "type": "string"
                    },
                    {
                      "const": "opening",
                      "type": "string"
                    }
                  ]
                }
              },
              "required": ["minM", "typicalM", "maxM", "reference"],
              "additionalProperties": false
            }
          ]
        },
        "depth": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "properties": {
                "minM": {
                  "type": "number"
                },
                "typicalM": {
                  "type": "number"
                },
                "maxM": {
                  "type": "number"
                },
                "reference": {
                  "anyOf": [
                    {
                      "const": "whole-bounds",
                      "type": "string"
                    },
                    {
                      "const": "withers",
                      "type": "string"
                    },
                    {
                      "const": "seat",
                      "type": "string"
                    },
                    {
                      "const": "worktop",
                      "type": "string"
                    },
                    {
                      "const": "opening",
                      "type": "string"
                    }
                  ]
                }
              },
              "required": ["minM", "typicalM", "maxM", "reference"],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": ["width", "height", "depth"],
      "additionalProperties": false
    },
    "preferredDimension": {
      "anyOf": [
        {
          "type": "null"
        },
        {
          "const": "width",
          "type": "string"
        },
        {
          "const": "height",
          "type": "string"
        },
        {
          "const": "depth",
          "type": "string"
        }
      ]
    },
    "grounding": {
      "anyOf": [
        {
          "const": "floor",
          "type": "string"
        },
        {
          "const": "support",
          "type": "string"
        },
        {
          "const": "architectural",
          "type": "string"
        },
        {
          "const": "unknown",
          "type": "string"
        }
      ]
    },
    "orientation": {
      "type": "object",
      "properties": {
        "up": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "const": "+Y",
              "type": "string"
            },
            {
              "const": "+Z",
              "type": "string"
            },
            {
              "const": "+X",
              "type": "string"
            },
            {
              "const": "-Y",
              "type": "string"
            },
            {
              "const": "-Z",
              "type": "string"
            },
            {
              "const": "-X",
              "type": "string"
            }
          ]
        },
        "forward": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "const": "+Z",
              "type": "string"
            },
            {
              "const": "+X",
              "type": "string"
            },
            {
              "const": "-Z",
              "type": "string"
            },
            {
              "const": "-X",
              "type": "string"
            }
          ]
        }
      },
      "required": ["up", "forward"],
      "additionalProperties": false
    },
    "affordances": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "clearances": {
      "type": "object",
      "properties": {
        "usableSideM": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "number"
            }
          ]
        },
        "circulationM": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "number"
            }
          ]
        }
      },
      "required": ["usableSideM", "circulationM"],
      "additionalProperties": false
    },
    "relationHints": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "provenance": {
      "type": "object",
      "properties": {
        "source": {
          "anyOf": [
            {
              "const": "curated",
              "type": "string"
            },
            {
              "const": "standard",
              "type": "string"
            },
            {
              "const": "ai_inferred",
              "type": "string"
            },
            {
              "const": "user_confirmed",
              "type": "string"
            },
            {
              "const": "project_specific",
              "type": "string"
            }
          ]
        },
        "producer": {
          "type": "string"
        },
        "model": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string"
            }
          ]
        },
        "inferenceVersion": {
          "type": "string"
        },
        "requestedClass": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "string"
            }
          ]
        },
        "confidence": {
          "type": "number"
        },
        "createdAt": {
          "type": "string"
        },
        "evidence": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "source",
        "producer",
        "model",
        "inferenceVersion",
        "requestedClass",
        "confidence",
        "createdAt",
        "evidence"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "schema",
    "schemaVersion",
    "profileId",
    "revision",
    "parentId",
    "semanticClass",
    "status",
    "dimensions",
    "preferredDimension",
    "grounding",
    "orientation",
    "affordances",
    "clearances",
    "relationHints",
    "provenance"
  ],
  "additionalProperties": false
}
