{
  "pluginAlias": "SmartThingsAC-KM81",
  "pluginType": "platform",
  "singular": true,
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "title": "플랫폼 이름",
        "type": "string",
        "default": "SmartThings AC",
        "required": true
      },
      "clientId": {
        "title": "Client ID",
        "type": "string",
        "description": "SmartThings Developer Workspace에서 발급받은 Client ID를 입력하세요.",
        "required": true
      },
      "clientSecret": {
        "title": "Client Secret",
        "type": "string",
        "description": "SmartThings Developer Workspace에서 발급받은 Client Secret을 입력하세요.",
        "required": true
      },
      "redirectUri": {
        "title": "Redirect URI",
        "type": "string",
        "description": "앱 생성 시 입력했던 Redirect URI와 동일한 값을 입력하세요. (예: http://<Homebridge IP>:8999/oauth/callback)",
        "default": "http://localhost:8999/oauth/callback",
        "required": true
      },
      "devices": {
        "title": "연동할 에어컨 장치",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "deviceLabel": {
              "title": "에어컨 이름 (SmartThings 레이블)",
              "type": "string",
              "description": "SmartThings 앱에 등록된 에어컨의 이름과 정확히 일치해야 합니다.",
              "required": true
            },
            "model": {
              "title": "모델명 (선택 사항)",
              "type": "string",
              "description": "홈 앱에 표시될 모델명을 입력합니다."
            },
            "serialNumber": {
              "title": "일련번호 (선택 사항)",
              "type": "string",
              "description": "홈 앱에 표시될 일련번호를 입력합니다."
            }
          }
        }
      }
    }
  },
  "layout": [
    "name",
    {
      "type": "help",
      "help": "<b>인증 설정:</b><br>1. Client ID, Client Secret, Redirect URI를 입력하고 Homebridge를 재시작하세요.<br>2. 로그에 출력되는 '인증 URL'을 웹 브라우저에서 열고 로그인 및 권한을 허용하면 자동으로 인증이 완료됩니다."
    },
    "clientId",
    "clientSecret",
    "redirectUri",
    {
      "key": "devices",
      "type": "array",
      "title": "에어컨 목록",
      "items": [
        "devices[].deviceLabel",
        "devices[].model",
        "devices[].serialNumber"
      ]
    }
  ]
}
