{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://github.com/krobipd/ioBroker.govee-smart/blob/main/devices.schema.json",
  "title": "Govee device support catalog",
  "type": "object",
  "required": ["devices"],
  "properties": {
    "_comment": {
      "type": "string",
      "description": "Optional top-level comment, ignored by the loader."
    },
    "devices": {
      "type": "object",
      "patternProperties": {
        "^[A-Z][0-9A-Z]{4}$": {
          "$ref": "#/definitions/deviceEntry"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "definitions": {
    "deviceEntry": {
      "type": "object",
      "required": ["name", "type", "status"],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "description": "Govee app name for the device — what users see in the Govee Home app."
        },
        "type": {
          "type": "string",
          "enum": [
            "light",
            "thermometer",
            "sensor",
            "heater",
            "humidifier",
            "dehumidifier",
            "fan",
            "air_purifier",
            "socket",
            "kettle",
            "ice_maker",
            "aroma_diffuser", "button"
          ],
          "description": "Device category — corresponds to Govee API type without the 'devices.types.' prefix."
        },
        "status": {
          "type": "string",
          "enum": ["verified", "reported", "seed"],
          "description": "verified = multiple confirmed reports, reported = 1 user with diagnostics, seed = imported from external source / untested."
        },
        "since": {
          "type": "string",
          "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
          "description": "Adapter version when this device was first supported (semver)."
        },
        "quirks": {
          "$ref": "#/definitions/quirks"
        }
      },
      "additionalProperties": false
    },
    "quirks": {
      "type": "object",
      "properties": {
        "colorTempRange": {
          "type": "object",
          "required": ["min", "max"],
          "properties": {
            "min": { "type": "integer", "minimum": 1000, "maximum": 12000 },
            "max": { "type": "integer", "minimum": 1000, "maximum": 12000 }
          },
          "additionalProperties": false,
          "description": "Override color-temperature range — Govee API often claims pauschal 2000-9000K, real range is narrower."
        },
        "segmentCount": {
          "type": "integer",
          "minimum": 1,
          "maximum": 55,
          "description": "Override segment count — Govee's segment capabilities sometimes advertise more slots than the strip physically has. Hard override of Cloud, cache and MQTT. Mainly for cloud-only SKUs that can't self-correct via AA-A5 status packets."
        },
        "brokenPlatformApi": {
          "type": "boolean",
          "description": "Cloud platform-API metadata is unreliable — adapter skips Cloud-cap mapping and falls back to LAN-default states."
        },
        "transportOverrides": {
          "type": "object",
          "description": "Per-command transport override — forces a command through Cloud or LAN regardless of the default LAN-first heuristic. Value 'lan' is a no-op (default routing).",
          "properties": {
            "power":            { "enum": ["cloud", "lan"] },
            "brightness":       { "enum": ["cloud", "lan"] },
            "colorRgb":         { "enum": ["cloud", "lan"] },
            "colorTemperature": { "enum": ["cloud", "lan"] },
            "lightScene":       { "enum": ["cloud", "lan"] },
            "diyScene":         { "enum": ["cloud", "lan"] },
            "snapshot":         { "enum": ["cloud", "lan"] },
            "gradientToggle":   { "enum": ["cloud", "lan"] },
            "segmentBatch":     { "enum": ["cloud", "lan"] }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
  }
}
