{
	"pluginAlias": "TuyaPlatform",
	"pluginType": "platform",
	"singular": true,
	"headerDisplay": "",
	"footerDisplay": "",
	"schema": {
		"type": "object",
		"properties": {
			"options": {
				"title": "Project Info",
				"type": "object",
				"required": true,
				"properties": {
					"projectType": {
						"title": "Project Type (Development Method)",
						"type": "string",
						"default": "2",
						"oneOf": [{
							"title": "Custom",
							"enum": ["1"]
						}, {
							"title": "Smart Home",
							"enum": ["2"]
						}],
						"required": true
					},
					"endpoint": {
						"title": "Endpoint URL",
						"type": "string",
						"format": "url"
					},
					"accessId": {
						"title": "Access ID",
						"type": "string",
						"required": true
					},
					"accessKey": {
						"title": "Access Secret",
						"type": "string",
						"required": true
					},
					"countryCode": {
						"title": "Country Code",
						"type": "integer",
						"minimum": 1,
						"condition": {
							"functionBody": "return model.options.projectType === '2';"
						}
					},
					"username": {
						"title": "Username",
						"type": "string",
						"condition": {
							"functionBody": "return model.options.projectType === '2';"
						}
					},
					"password": {
						"title": "Password",
						"type": "string",
						"condition": {
							"functionBody": "return model.options.projectType === '2';"
						}
					},
					"appSchema": {
						"title": "App",
						"type": "string",
						"default": "tuyaSmart",
						"oneOf": [{
								"title": "Tuya Smart",
								"enum": ["tuyaSmart"]
							},
							{
								"title": "Smart Life",
								"enum": ["smartlife"]
							}
						],
						"condition": {
							"functionBody": "return model.options.projectType === '2';"
						}
					},
					"homeWhitelist": {
						"title": "Whitelisted Home IDs",
						"description": "An optional list of Home IDs to match. If blank, all homes are matched.",
						"type": "array",
						"items": {
							"title": "Home ID",
							"type": "integer"
						},
						"condition": {
							"functionBody": "return model.options.projectType === '2';"
						}
					},
					"deviceOverrides": {
						"title": "Device Overriding Configs",
						"type": "array",
						"items": {
							"type": "object",
							"properties": {
								"id": {
									"title": "ID",
									"description": "Device ID or Product ID or `global`",
									"type": "string",
									"required": true
								},
								"category": {
									"title": "Category",
									"description": "Category Code or `hidden`",
									"type": "string"
								},
								"schema": {
									"title": "Schema Overriding Configs",
									"type": "array",
									"items": {
										"type": "object",
										"properties": {
											"code": {
												"title": "DP Code",
												"type": "string",
												"required": true
											},
											"newCode": {
												"title": "New DP Code",
												"type": "string"
											},
											"type": {
												"title": "New DP Type",
												"type": "string",
												"default": "Boolean",
												"oneOf": [{
													"title": "Boolean",
													"enum": ["Boolean"]
												}, {
													"title": "Integer",
													"enum": ["Integer"]
												}, {
													"title": "Enum",
													"enum": ["Enum"]
												}, {
													"title": "String",
													"enum": ["String"]
												}, {
													"title": "Json",
													"enum": ["Json"]
												}, {
													"title": "Raw",
													"enum": ["Raw"]
												}]
											},
											"property": {
												"title": "New DP Property",
												"type": "object",
												"properties": {
													"min": {
														"title": "min",
														"type": "integer"
													},
													"max": {
														"title": "max",
														"type": "integer"
													},
													"scale": {
														"title": "scale",
														"type": "integer"
													},
													"step": {
														"title": "step",
														"type": "integer"
													},
													"range": {
														"title": "range",
														"type": "array",
														"items": {
															"title": "value",
															"type": "string"
														}
													}
												}
											},
											"hidden": {
												"title": "Hidden",
												"type": "boolean"
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
  }
}
