{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aqara/json-schema/aqara-spaces-response-schema.json",
  "title": "SpacesResponse",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aiot-api-zh.yaml#/components/schemas/SpacesResponse",
  "allOf": [
    {
      "$ref": "#/$defs/BaseResponse"
    },
    {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SpaceNode"
          }
        }
      }
    }
  ],
  "$defs": {
    "BaseResponse": {
      "type": "object",
      "required": [
        "type",
        "version",
        "msgId",
        "code"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "消息类型。"
        },
        "version": {
          "type": "string",
          "description": "接口版本。"
        },
        "msgId": {
          "type": "string",
          "description": "消息 ID。"
        },
        "code": {
          "type": "integer",
          "description": "业务状态码，0 表示成功。"
        },
        "message": {
          "type": "string",
          "description": "提示信息。"
        }
      }
    },
    "SpaceNode": {
      "type": "object",
      "required": [
        "spaceId",
        "name"
      ],
      "properties": {
        "spaceId": {
          "type": "string",
          "description": "空间 ID。"
        },
        "parentSpaceId": {
          "type": [
            "string",
            "null"
          ],
          "description": "父空间 ID。"
        },
        "name": {
          "type": "string",
          "description": "空间名称。"
        },
        "spatialMarking": {
          "type": [
            "string",
            "null"
          ],
          "description": "空间标记。"
        },
        "children": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "object",
            "properties": {
              "spaceId": {
                "type": "string",
                "description": "子空间 ID。"
              },
              "parentSpaceId": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "父空间 ID。"
              },
              "name": {
                "type": "string",
                "description": "子空间名称。"
              },
              "spatialMarking": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "子空间标记。"
              },
              "children": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "object",
                  "properties": {
                    "spaceId": {
                      "type": "string"
                    },
                    "parentSpaceId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "spatialMarking": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                },
                "description": "孙级及更深层子空间列表（结构同子空间节点，按此模式递归）。"
              }
            }
          },
          "description": "子空间列表（树结构）。"
        }
      }
    }
  }
}