{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/api-evangelist/spiceworks/json-schema/spiceworks-device-schema.json",
  "title": "Spiceworks Inventory Device",
  "description": "JSON Schema for a managed IT device in the Spiceworks inventory, including hardware specs, software inventory, and network configuration.",
  "type": "object",
  "required": ["id", "name", "type"],
  "properties": {
    "id": {
      "type": "integer",
      "description": "Unique device identifier"
    },
    "name": {
      "type": "string",
      "description": "Device hostname or display name"
    },
    "type": {
      "type": "string",
      "description": "Device type classification",
      "enum": ["workstation", "server", "network", "printer", "mobile", "unknown"]
    },
    "manufacturer": {
      "type": "string",
      "description": "Device manufacturer name"
    },
    "model": {
      "type": "string",
      "description": "Device model name"
    },
    "serial_number": {
      "type": "string",
      "description": "Device serial number"
    },
    "ip_address": {
      "type": "string",
      "format": "ipv4",
      "description": "Primary IP address"
    },
    "mac_address": {
      "type": "string",
      "description": "Primary MAC address",
      "pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"
    },
    "os_name": {
      "type": "string",
      "description": "Operating system name"
    },
    "os_version": {
      "type": "string",
      "description": "Operating system version"
    },
    "cpu": {
      "type": "string",
      "description": "CPU model and speed"
    },
    "ram_mb": {
      "type": "integer",
      "description": "Total RAM in megabytes",
      "minimum": 0
    },
    "disk_gb": {
      "type": "number",
      "description": "Total disk capacity in gigabytes",
      "minimum": 0
    },
    "last_seen_at": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the device was last detected"
    },
    "warranty_expiry": {
      "type": "string",
      "format": "date",
      "description": "Device warranty expiration date"
    },
    "software": {
      "type": "array",
      "description": "Installed software applications",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Application name"
          },
          "version": {
            "type": "string",
            "description": "Application version"
          }
        }
      }
    }
  }
}
