

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 托管集成数据模型
<a name="managedintegrations-data-model"></a>

托管集成数据模型管理最终用户与托管集成之间的所有通信。

**设备层次结构**

`endpoint`和`capability`数据元素用于描述托管集成数据模型中的设备。

**`endpoint`**

`endpoint`表示该功能提供的逻辑接口或服务。

```
{
    "endpointId": { "type":"string" },
    "capabilities": Capability[]
}
```

**`Capability`**

`capability`代表设备功能。

```
{
    "$id": "string",                // Schema identifier (e.g. /schema-versions/capability/matter.OnOff@1.4)
    "name": "string",               // Human readable name
    "version": "string",            // e.g. 1.0  
    "properties": Property[],
    "actions": Action[],
    "events": Event[]
}
```

对于`capability`数据元素，有三个项目构成该项目：`property``action`、和`event`。它们可用于与设备交互和监控。
+ **属性**：设备保持的状态，例如可调光灯的当前亮度等级属性。
  + 

    ```
    {
        "name":                      // Property Name is outside of Property Entity
        "value": Value,              // value represented in any type e.g. 4, "A", []
        "lastChangedAt": Timestamp   // ISO 8601 Timestamp upto milliseconds yyyy-MM-ddTHH:mm:ss.ssssssZ
        "mutable": boolean,
        "retrievable": boolean,
        "reportable": boolean
        
    }
    ```
+ **操作**：可以执行的任务，例如在门锁上锁门。操作可能会产生响应和结果。
  + 

    ```
    { 
        "name": { "$ref": "/schema-versions/definition/aws.name@1.0" }, //required 
        "parameters": Map<String name, JSONNode value>, 
        "responseCode": HTTPResponseCode,
        "errors": { 
            "code": "string",
            "message": "string"
        }
    }
    ```
+ **事件**：本质上是过去状态转换的记录。虽然事件`property`代表当前的状态，但却是过去的日记，包括单调递增的计数器、时间戳和优先级。它们支持捕获状态转换，以及无法轻易实现的数据建模`property`。
  + 

    ```
    {
        "name": { "$ref": "/schema-versions/definition/aws.name@1.0" },        //required
        "parameters": Map<String name, JSONNode value> 
    }
    ```