{
  "pluginAlias": "DenonHeosAudio",
  "pluginType": "platform",
  "singular": true,
  "strictValidation": true,
  "schema": {
    "type": "object",
    "properties": {
      "deviceDiscovery": {
        "title": "Device Discovery",
        "description": "Enable to automatically discover Denon devices on your network. (Found devices will be listed in the homebridge log after the plugin has started. Ensure that your homebridge's log level is at least set to 'info' or enable the console log below.)",
        "type": "boolean",
        "required": false,
        "default": true
      },
      "devices": {
        "title": "Devices",
        "description": "Add your Denon devices here.",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "title": "Name",
              "type": "string",
              "placeholder": "Give your speaker a name",
              "required": true
            },
            "serialNumber": {
              "title": "Serial Number",
              "description": "If you don't know your device's serial number, use 'device discovery' to find it.",
              "type": "string",
              "required": true
            },
            "ip": {
              "title": "IP Address",
              "description": "Please assign a static IP address to your device and enter it here.",
              "type": "string",
              "format": "ipv4",
              "required": true
            },
            "controlProtocol": {
              "title": "Control Protocol",
              "type": "string",
              "oneOf": [
                {
                  "const": "AVRCONTROL",
                  "title": "AVR Control"
                },
                {
                  "const": "HEOSCLI",
                  "title": "Heos CLI"
                },
                {
                  "const": "HYBRID",
                  "title": "Hybrid"
                }
              ],
              "required": true
            },
            "volumeLimitEnabled": {
              "title": "Volume Limit",
              "description": "When you set a volume limit, 100% volume in HomeKit will correspond to this percentage on your device.",
              "type": "boolean",
              "required": false,
              "default": false
            },
            "volumeLimit": {
              "description": "only has an effect if volume limit is enabled above",
              "type": "integer",
              "required": false,
              "minimum": 0,
              "maximum": 99,
              "default": 99
            },
            "volumeStepSize": {
              "title": "Volume Step Size",
              "description": "Determines how many percentage points the volume is increased or descreased when volume up or down is pressed. This is measured in the device's percentage points - not converted for volume limit.",
              "type": "integer",
              "required": false,
              "minimum": 1,
              "maximum": 10,
              "default": 2
            },
            "inputs": {
              "title": "Inputs",
              "description": "The list of inputs to your device.",
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "inputID": {
                    "title": "Input ID",
                    "type": "string",
                    "placeholder": "AUX1",
                    "required": true,
                    "typeahead": {
                      "source": [
                        "ANALOG1",
                        "ANALOG2",
                        "AUX1",
                        "AUX2",
                        "BD",
                        "CBL/SAT",
                        "CD",
                        "DOCK",
                        "DVD",
                        "FAVORITES",
                        "GAME",
                        "GAME2",
                        "IPOD",
                        "IRADIO",
                        "IRP",
                        "LASTFM",
                        "MPLAY",
                        "NET",
                        "NET/USB",
                        "NETWORK",
                        "OPTICAL1",
                        "OPTICAL2",
                        "PANDORA",
                        "RHAPSODY",
                        "SAT/CBL",
                        "SERVER",
                        "SPOTIFY",
                        "TUNER",
                        "TV",
                        "USB/IPOD",
                        "aux_in_1",
                        "aux_in_2",
                        "aux_in_3",
                        "aux_in_4",
                        "aux_single",
                        "aux1",
                        "aux2",
                        "aux3",
                        "aux4",
                        "aux5",
                        "aux6",
                        "aux7",
                        "aux_8k",
                        "line_in_1",
                        "line_in_2",
                        "line_in_3",
                        "line_in_4",
                        "coax_in_1",
                        "coax_in_2",
                        "optical_in_1",
                        "optical_in_2",
                        "optical_in_3",
                        "hdmi_in_1",
                        "hdmi_in_2",
                        "hdmi_in_3",
                        "hdmi_in_4",
                        "hdmi_arc_1",
                        "cable_sat",
                        "dvd",
                        "bluray",
                        "game",
                        "game2",
                        "mediaplayer",
                        "cd",
                        "tuner",
                        "hdradio",
                        "tvaudio",
                        "phono",
                        "usbdac",
                        "analog_in_1",
                        "analog_in_2",
                        "recorder_in_1",
                        "tv"
                      ]
                    }
                  },
                  "name": {
                    "title": "Display Name",
                    "type": "string",
                    "placeholder": "Aux",
                    "required": true,
                    "minLength": 1
                  },
                  "showInList": {
                    "title": "Show in Input List",
                    "description": "If disabled, this input will not be shown in the list of selectable inputs in HomeKit.",
                    "type": "boolean",
                    "required": false,
                    "default": true
                  }
                }
              }
            }
          }
        },
        "sources": {
          "title": "Selectable playing sources",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "sourceID": {
                "title": "Source ID",
                "description": "If you don't know the source ID of the playing source, activate \"playing source logging\" for this device, switch sources manually and look out for the input IDs in the homebridge log.",
                "type": "string",
                "required": true
              },
              "name": {
                "title": "Source name",
                "description": "Choose a display name for this playing source.",
                "type": "string",
                "required": true
              }
            }
          }
        }
      },
      "consoleLogEnabled": {
        "title": "Console Log",
        "description": "Diverts the log messages directly to the console. This is only intended for debugging purposes.",
        "type": "boolean",
        "required": false,
        "default": false
      },
      "consoleLogLevel": {
        "title": "Log Level",
        "description": "If console log is enabled, only log messages at this log level or below it will be displayed in the console.",
        "type": "string",
        "enum": ["error", "warn", "success", "info", "debug"],
        "required": false,
        "default": "debug"
      }
    }
  }
}
