{
  "pluginAlias": "BondBridge",
  "pluginType": "platform",
  "singular": true,
  "customUi": true,
  "headerDisplay": "Homebridge plugin for BondBridge devices",
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "title": "Name",
        "type": "string",
        "default": "BondBridge",
        "required": true
      },
      "debug": {
        "title": "Enable detailed debug log for this plugin",
        "description": "Enables a detailed debug log. Useful when trying to figure out issues with the plugin.",
        "type": "boolean",
        "required": false,
        "default": false
      },
      "devices": {
        "type": "array",
        "minItems": 1,
        "maxItems": 3,
        "items": {
          "type": "object",
          "properties": {
            "ipAddress": {
              "title": "Bond ID or IP Address (BondID preferred)",
              "description": "Enter the Bond ID or local IP address.",
              "type": "string",
              "pattern": "^(?:[A-Z0-9]{6}(?:[A-Z0-9]{3})?|(?:[0-9]{1,3}\\.){3}[0-9]{1,3})$",
              "required": true,
              "errorMessage": "Must be a valid Bond ID or valid IPv4 address."
            },
            "token": {
              "title": "Local Token",
              "description": "Enter your Bond local token (16 or 43 characters).",
              "type": "string",
              "pattern": "^(?:[A-Za-z0-9_-]{16}|[A-Za-z0-9_-]{43})$",
              "required": true,
              "placeholder": ""
            },
            "debug": {
              "title": "Enable detailed debug log for this device",
              "description": "Enables a detailed debug log. Useful when trying to figure out issues with this device.",
              "type": "boolean",
              "required": false,
              "default": false
            },
            "CFsettings": {
              "title": "Ceiling Fan settings",
              "type": "object",
              "properties": {
                "setupOption": {
                  "title": "Ceiling Fan Setup Option",
                  "description": "Choose an option from this drop down menu.",
                  "type": "string",
                  "required": true,
                  "oneOf": [
                    {
                      "title": "Configure only a Ceiling Fan with SpeedControl",
                      "enum": [
                        "fan"
                      ]
                    },
                    {
                      "title": "Configure a Ceiling fan with SpeedControl and a Light Switch",
                      "enum": [
                        "fanLight"
                      ]
                    },
                    {
                      "title": "Configure a Ceiling Fan with SpeedControl and a Light with Dimmer",
                      "enum": [
                        "fanLightDimmer"
                      ]
                    },
                    {
                      "title": "Configure only a Light Dimmer",
                      "enum": [
                        "lightDimmer"
                      ]
                    },
                    {
                      "title": "Do not configure this Ceiling Fan",
                      "enum": [
                        "doNotConfigure"
                      ]
                    }
                  ],
                  "default": "fanLightDimmer"
                },
                  "timerSetup": {
                  "title": "Include Timers",
                  "description": "Configure a Fan timer and a Light timer, otherwise no timers.",
                  "type": "boolean",
                  "required": true,
                  "default": false
                }
              }
            }
          }
        }
      }
    }
  },
  "layout": [
    {
      "type": "fieldset",
      "title": "Bond Bridge Device Settings",
      "description": "NOTE: define not more than 3 Bond Bridge devices because only a maximum of 3 Bond Bridge devices can be processed",
      "items": []
    },
    {
      "key": "devices",
      "type": "tabarray",
      "title": "{{ value.ipAddress || 'new device' }}",
      "items": [
        "devices[].ipAddress",
        "devices[].token",
        "devices[].debug",
        {
          "key": "devices[]",
          "type": "fieldset`",
          "items": [
            {
              "type": "fieldset",
              "title": "Ceiling Fan and its associated Light specific settings",
              "expandable": true,
              "expanded": false,
              "items": [
                "devices[].CFsettings.setupOption",
                "devices[].CFsettings.timerSetup"
              ]
            }
          ]
        }
      ]
    },
    {
      "type": "fieldset",
      "title": "Global Plugin Settings",
      "expandable": true,
      "expanded": false,
      "items": [
        "debug"
      ]
    }
  ]
}
