

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 受管整合資料模型
<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> 
    }
    ```