{
  "pluginAlias": "WinixPurifiers",
  "pluginType": "platform",
  "singular": true,
  "customUi": true,
  "customUiPath": "./dist/homebridge-ui",
  "schema": {
    "type": "object",
    "properties": {
      "exposeAirQuality": {
        "title": "Air Quality Sensor",
        "description": "Expose the air quality sensor",
        "type": "boolean",
        "default": false
      },
      "exposeAmbientLight": {
        "title": "Ambient Light Sensor",
        "description": "Expose the ambient light sensor",
        "type": "boolean",
        "default": false
      },
      "exposePlasmawave": {
        "title": "Plasmawave Switch",
        "description": "Expose the Plasmawave on/off switch",
        "type": "boolean",
        "default": false
      },
      "exposeAutoSwitch": {
        "title": "Auto Switch",
        "description": "Expose the Auto on/off switch",
        "type": "boolean",
        "default": false
      },
      "exposeSleepSwitch": {
        "title": "Sleep Switch",
        "description": "Expose the Sleep on/off switch",
        "type": "boolean",
        "default": false
      },
      "filterReplacementIndicatorPercentage": {
        "title": "Filter Replacement Indicator Percentage",
        "description": "Percentage of filter life remaining to trigger a filter replacement alert",
        "type": "integer",
        "default": 10,
        "minimum": 0,
        "maximum": 100,
        "required": true
      },
      "pollIntervalSeconds": {
        "title": "Poll Interval (seconds)",
        "description": "How often to poll the Winix API for device state updates",
        "type": "integer",
        "default": 30,
        "minimum": 15,
        "required": true
      },
      "deviceRefreshIntervalMinutes": {
        "title": "Device Refresh Interval (minutes)",
        "description": "Time, in minutes, for how often to poll Winix to refresh the device list. You can always just restart Homebridge to refresh the device list",
        "type": "integer",
        "default": 60,
        "minimum": 1,
        "required": true
      },
      "auth": {
        "type": "object",
        "title": "Authentication",
        "properties": {
          "username": {
            "type": "string",
            "title": "Username",
            "description": "Your Winix account username (email)",
            "readonly": true
          },
          "password": {
            "type": "string",
            "title": "Password",
            "description": "Your Winix account password (encrypted)",
            "readonly": true
          },
          "userId": {
            "type": "string",
            "title": "User ID",
            "description": "Your Winix user ID",
            "readonly": true
          }
        },
        "required": [
          "username",
          "password",
          "userId"
        ]
      },
      "deviceOverrides": {
        "type": "array",
        "title": "Device Overrides",
        "description": "Override the default device configuration for a specific device",
        "items": {
          "type": "object",
          "properties": {
            "deviceId": {
              "type": "string",
              "title": "Device ID",
              "description": "The ID of the device",
              "required": true,
              "readonly": true
            },
            "serialNumber": {
              "type": "string",
              "title": "Serial Number",
              "description": "The serial number of the device",
              "placeholder": "WNXAI00000000",
              "required": false
            },
            "nameDevice": {
              "type": "string",
              "title": "Device Name",
              "description": "The display name of the device",
              "required": false
            },
            "nameAirQualitySensor": {
              "type": "string",
              "title": "Air Quality Sensor Name",
              "description": "The display name of the air quality sensor",
              "placeholder": "Air Quality",
              "required": false
            },
            "nameAmbientLightSensor": {
              "type": "string",
              "title": "Ambient Light Sensor Name",
              "description": "The display name of the ambient light sensor",
              "placeholder": "Ambient Light",
              "required": false
            },
            "namePlasmawaveSwitch": {
              "type": "string",
              "title": "Plasmawave Switch Name",
              "description": "The display name of the Plasmawave switch",
              "placeholder": "Plasmawave",
              "required": false
            },
            "nameAutoSwitch": {
              "type": "string",
              "title": "Auto Switch Name",
              "description": "The display name of the Auto switch",
              "placeholder": "Auto Mode",
              "required": false
            }
          }
        }
      }
    }
  },
  "layout": [
    {
      "type": "fieldset",
      "title": "Options",
      "description": "Configuration options for Winix Purifiers",
      "expandable": true,
      "expanded": true,
      "orderable": false,
      "items": [
        "exposeAirQuality",
        "exposeAmbientLight",
        "exposePlasmawave",
        "exposeAutoSwitch",
        "exposeSleepSwitch",
        "filterReplacementIndicatorPercentage",
        "pollIntervalSeconds",
        "deviceRefreshIntervalMinutes"
      ]
    },
    {
      "type": "fieldset",
      "title": "Authentication",
      "description": "Generated Winix credentials (read-only)",
      "expandable": true,
      "expanded": false,
      "orderable": false,
      "items": [
        "auth.username",
        "auth.password",
        "auth.userId"
      ]
    }
  ]
}
