{
  "pluginAlias": "config",
  "pluginType": "platform",
  "singular": true,
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "title": "Name",
        "type": "string",
        "default": "Config",
        "minLength": 1,
        "required": true
      },
      "port": {
        "title": "Port",
        "type": "integer",
        "default": 8080,
        "maximum": 65535,
        "required": true
      },
      "auth": {
        "title": "Auth Mode",
        "type": "string",
        "default": "form",
        "oneOf": [
          {
            "title": "Form",
            "enum": [
              "form"
            ]
          },
          {
            "title": "None",
            "enum": [
              "none"
            ]
          }
        ],
        "required": true
      },
      "theme": {
        "title": "UI Theme",
        "type": "string",
        "default": "amber",
        "oneOf": [
          {
            "title": "Red",
            "enum": [
              "red"
            ]
          },
          {
            "title": "Pink",
            "enum": [
              "pink"
            ]
          },
          {
            "title": "Purple",
            "enum": [
              "purple"
            ]
          },
          {
            "title": "Purple - Deep",
            "enum": [
              "deep-purple"
            ]
          },
          {
            "title": "Indigo",
            "enum": [
              "indigo"
            ]
          },
          {
            "title": "Blue",
            "enum": [
              "blue"
            ]
          },
          {
            "title": "Blue - Navi",
            "enum": [
              "navi-blue"
            ]
          },
          {
            "title": "Blue Grey",
            "enum": [
              "blue-grey"
            ]
          },
          {
            "title": "Cyan",
            "enum": [
              "cyan"
            ]
          },
          {
            "title": "Green",
            "enum": [
              "green"
            ]
          },
          {
            "title": "Teal",
            "enum": [
              "teal"
            ]
          },
          {
            "title": "Orange",
            "enum": [
              "orange"
            ]
          },
          {
            "title": "Amber",
            "enum": [
              "amber"
            ]
          },
          {
            "title": "Grey",
            "enum": [
              "grey"
            ]
          },
          {
            "title": "Brown",
            "enum": [
              "brown"
            ]
          },
          {
            "title": "Dark Mode",
            "enum": [
              "dark-mode"
            ]
          }
        ],
        "required": true
      },
      "restart": {
        "title": "Restart Command",
        "type": "string"
      },
      "temp": {
        "title": "Path to OS Temp File",
        "type": "string"
      },
      "tempUnits": {
        "title": "Temperature Display Units",
        "type": "string",
        "required": true,
        "default": "c",
        "oneOf": [
          {
            "title": "Celsius",
            "enum": [
              "c"
            ]
          },
          {
            "title": "Fahrenheit",
            "enum": [
              "f"
            ]
          }
        ]
      },
      "loginWallpaper": {
        "title": "Path to Login Wallpaper Image File",
        "type": "string"
      },
      "sudo": {
        "title": "Use Sudo",
        "type": "boolean"
      },
      "homebridgePackagePath": {
        "title": "Path To Homebridge Module",
        "type": "string"
      },
      "noFork": {
        "title": "Do not run the Config UI web server in a seperate process/thread",
        "type": "boolean"
      },
      "host": {
        "title": "The host ip address to listen on. In most cases this will be '::' or '0.0.0.0'",
        "type": "string"
      },
      "debug": {
        "title": "Enable / disable debug logging",
        "type": "boolean"
      },
      "standalone": {
        "title": "Tell Homebridge the plugin is operating in standalone mode",
        "type": "boolean"
      },
      "websocketCompatibilityMode": {
        "title": "Run the web socket connection in compatibility mode",
        "type": "boolean"
      },
      "sessionTimeout": {
        "title": "Session timeout in seconds",
        "type": "integer"
      },
      "log": {
        "type": "object",
        "properties": {
          "method": {
            "title": "Log Method",
            "type": "string",
            "oneOf": [
              {
                "title": "From File",
                "enum": [
                  "file"
                ]
              },
              {
                "title": "Systemd",
                "enum": [
                  "systemd"
                ]
              },
              {
                "title": "Custom Command",
                "enum": [
                  "custom"
                ]
              }
            ]
          },
          "path": {
            "title": "Log File Path",
            "type": "string"
          },
          "service": {
            "title": "Systemd Service",
            "type": "string"
          },
          "command": {
            "title": "Custom Command",
            "type": "string"
          },
          "tail": {
            "type": "string",
            "description": "Depreciated"
          },
          "systemd": {
            "type": "string",
            "description": "Depreciated"
          }
        }
      },
      "ssl": {
        "title": "SSL Setup",
        "type": "object",
        "properties": {
          "key": {
            "title": "Path To Private Key",
            "type": "string"
          },
          "cert": {
            "title": "Path To Certificate",
            "type": "string"
          },
          "pfx": {
            "title": "Path To PKCS#12 Certificate",
            "type": "string"
          },
          "passphrase": {
            "title": "PKCS#12 Certificate Passphrase",
            "type": "string"
          }
        }
      },
      "linux": {
        "title": "Linux Server Commands",
        "type": "object",
        "properties": {
          "shutdown": {
            "title": "Shutdown Command",
            "type": "string"
          },
          "restart": {
            "title": "Restart Command",
            "type": "string"
          }
        }
      },
      "proxyHost": {
        "title": "Reverse Proxy Hostname",
        "type": "string",
        "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$"
      }
    }
  },
  "form": [
    "name",
    "port",
    "auth",
    "theme",
    "sudo",
    {
      "type": "fieldset",
      "expandable": true,
      "title": "Log Viewer Setup",
      "items": [
        "log.method",
        {
          "key": "log.path",
          "description": "Enter the full file path to your log file.",
          "required": true,
          "condition": {
            "functionBody": "return (model.log && model.log.method==='file')"
          }
        },
        {
          "key": "log.service",
          "description": "Enter the systemd service name. Defaults to 'homebridge'.",
          "placeholder": "homebridge",
          "required": true,
          "condition": {
            "functionBody": "return (model.log && model.log.method==='systemd')"
          }
        },
        {
          "key": "log.command",
          "description": "This command should stream the logs to stdout.",
          "required": true,
          "condition": {
            "functionBody": "return (model.log && model.log.method==='custom')"
          }
        }
      ]
    },
    {
      "type": "fieldset",
      "expandable": true,
      "title": "Advanced",
      "items": [
        {
          "key": "restart",
          "description": "If no restart command is set the process will terminate with a non-zero exit code."
        },
        {
          "key": "proxyHost",
          "placeholder": "eg. example.com:8443",
          "description": "When running behind a reverse proxy you may need to enter the hostname you use to access the UI."
        },
        {
          "key": "loginWallpaper",
          "description": "Leave blank to use default wallpaper."
        },
        {
          "key": "temp",
          "placeholder": "eg. /sys/class/thermal/thermal_zone0/temp"
        },
        "tempUnits",
        {
          "key": "homebridgePackagePath",
          "description": "Leave blank unless you have not installed Homebridge as a global module."
        },
        "websocketCompatibilityMode"
      ]
    },
    {
      "type": "fieldset",
      "expandable": true,
      "title": "SSL Setup",
      "items": [
        {
          "type": "help",
          "helpvalue": "<em class='primary-text'>Leave these fields blank to disable SSL.</em><br><em class='text-danger'>After enabling SSL you will only be able to access the Config UI using https://</div>"
        },
        "ssl.key",
        "ssl.cert",
        "ssl.pfx",
        "ssl.passphrase"
      ]
    }
  ]
}