{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aqara/json-schema/aqara-devices-response-schema.json",
  "title": "DevicesResponse",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aiot-api-zh.yaml#/components/schemas/DevicesResponse",
  "allOf": [
    {
      "$ref": "#/$defs/BaseResponse"
    },
    {
      "type": "object",
      "properties": {
        "data": {
          "$ref": "#/$defs/DeviceListData"
        }
      }
    }
  ],
  "$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": "提示信息。"
        }
      }
    },
    "DeviceInfo": {
      "type": "object",
      "required": [
        "deviceId",
        "deviceName",
        "deviceTypesList",
        "createTime",
        "state",
        "space"
      ],
      "properties": {
        "deviceId": {
          "type": "string",
          "description": "设备 ID。"
        },
        "gatewayId": {
          "type": [
            "string",
            "null"
          ],
          "description": "所属网关 ID。"
        },
        "deviceName": {
          "type": "string",
          "description": "设备名称。"
        },
        "deviceTypesList": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "设备类型列表。"
        },
        "createTime": {
          "type": "integer",
          "format": "int64",
          "description": "创建时间（毫秒时间戳）。"
        },
        "state": {
          "type": "boolean",
          "description": "设备在线状态。"
        },
        "space": {
          "$ref": "#/$defs/DeviceSpace",
          "description": "设备关联的空间信息。"
        }
      }
    },
    "DeviceListData": {
      "type": "object",
      "required": [
        "totalCount",
        "pageNum",
        "pageSize",
        "data"
      ],
      "properties": {
        "totalCount": {
          "type": "integer",
          "description": "满足条件的设备总数。"
        },
        "pageNum": {
          "type": "integer",
          "description": "当前页码。"
        },
        "pageSize": {
          "type": "integer",
          "description": "当前页大小。"
        },
        "data": {
          "type": "array",
          "description": "当前页设备列表。",
          "items": {
            "$ref": "#/$defs/DeviceInfo"
          }
        }
      }
    },
    "DeviceSpace": {
      "type": "object",
      "required": [
        "parentSpaceId",
        "spaceId",
        "name"
      ],
      "properties": {
        "parentSpaceId": {
          "type": "string",
          "description": "父空间 ID。"
        },
        "spaceId": {
          "type": "string",
          "description": "空间 ID。"
        },
        "name": {
          "type": "string",
          "description": "空间名称。"
        }
      }
    }
  }
}