{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "#Device",
    "description": "A physical device or media, such as a server, laptop, workstation, smartphone, tablet, router, firewall, switch, wifi-access-point, usb-drive, etc. The exact data type is described in the _type property of the Entity.",
    "type": "object",
    "allOf": [
        {
            "$ref": "#Entity"
        },
        {
            "properties": {
                "category": {
                    "description": "The device category",
                    "type": ["string", "null"],
                    "examples": [
                        "server",
                        "endpoint",
                        "storage-media",
                        "mobile",
                        "network",
                        "other"
                    ]
                },
                "displayName": {
                    "description": "The display name of the device",
                    "type": "string"
                },
                "ipv4Addresses": {
                    "description": "The IPv4 Addresses associated with the Device",
                    "oneOf": [
                        {
                            "type": "array",
                            "uniqueItems": true,
                            "items": {
                                "type": "string",
                                "format": "ipv4"
                            }
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "ipv6Addresses": {
                    "description": "The IPv6 Addresses associated with the Device",
                    "oneOf": [
                        {
                            "type": "array",
                            "uniqueItems": true,
                            "items": {
                                "type": "string",
                                "format": "ipv6"
                            }
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "macAddresses": {
                    "description": "The MAC Addresses associated with the Device, lowercase colon delimited",
                    "oneOf": [
                        {
                            "type": "array",
                            "uniqueItems": true,
                            "items": {
                                "type": "string",
                                "pattern": "^([0-9a-f]{2}:){5}([0-9a-f]{2})$"
                            }
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "publicIpAddresses": {
                    "description": "The public IP addresses associated with the Device",
                    "oneOf": [
                        {
                            "type": "array",
                            "uniqueItems": true,
                            "items": {
                                "type": "string",
                                "format": "ip"
                            }
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "privateIpAddresses": {
                    "description": "The private IP addresses associated with the Device",
                    "oneOf": [
                        {
                            "type": "array",
                            "uniqueItems": true,
                            "items": {
                                "type": "string",
                                "format": "ip"
                            }
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "hostname": {
                    "description": "The primary/local hostname",
                    "oneOf": [
                        {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "fqdn": {
                    "description": "The fully qualified domain name of the Device",
                    "oneOf": [
                        {
                            "type": "array",
                            "uniqueItems": true,
                            "items": {
                                "type": "string",
                                "pattern": "(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\\.)+[a-zA-Z]{2,63}$)"
                            }
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "serial": {
                    "description": "Same as hardwareSerial: The device serial number",
                    "type": ["string", "null"]
                },
                "deviceId": {
                    "description": "The unique device identifier, traditionally known as a UDID",
                    "oneOf": [
                        {
                            "type": "array",
                            "uniqueItems": true,
                            "items": {
                                "type": "string"
                            }
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "lastSeenOn": {
                    "description": "The timestamp (in milliseconds since epoch) when the device was either last checked in or was scanned.",
                    "oneOf": [
                        {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 253402300799999
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "make": {
                    "description": "Same as hardwareVendor: The manufacturer or vendor of the device, e.g. Apple Inc., Generic",
                    "type": ["string", "null"]
                },
                "model": {
                    "description": "Same as hardwareModel: The device hardware model, e.g. MacBookPro13,3",
                    "type": ["string", "null"]
                },
                "osName": {
                    "description": "Operating System Name (e.g. macOS, Windows 10)",
                    "type": ["string", "null"]
                },
                "osType": {
                    "description": "Operating System Platform",
                    "oneOf": [
                        {
                            "type": "string",
                            "enum": [
                                "darwin",
                                "linux",
                                "unix",
                                "windows",
                                "android",
                                "ios",
                                "chromeos",
                                "legacy",
                                "embedded",
                                "other"
                            ]
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "osDetails": {
                    "description": "Operating System Full Details (e.g. macOS High Sierra version 10.13.6)",
                    "type": ["string", "null"]
                },
                "osVersion": {
                    "description": "Operating System Version (e.g. 10.13.6)",
                    "type": ["string", "null"]
                },
                "status": {
                    "description": "Status label of this device",
                    "type": ["string", "null"],
                    "enum": [
                        "assigned",
                        "archived",
                        "decommissioned",
                        "defective",
                        "deployed",
                        "disposed",
                        "locked",
                        "lost/stolen",
                        "pending",
                        "ready",
                        "unknown",
                        "other"
                    ]
                },
                "version": {
                    "description": "Same as hardwareVersion: The device hardware version",
                    "type": "string"
                },
                "hardwareVendor": {
                    "description": "The manufacturer or vendor of the device, e.g. Apple Inc., Generic",
                    "type": "string"
                },
                "hardwareModel": {
                    "description": "The device hardware model, e.g. MacBookPro13,3",
                    "type": "string"
                },
                "hardwareVersion": {
                    "description": "The device hardware version",
                    "type": "string"
                },
                "hardwareSerial": {
                    "description": "The device serial number",
                    "type": "string"
                },
                "userEmails": {
                    "description": "The email addresses of the users this device is assigned to. Used if the device is shared by more than one user. Otherwise the 'owner' is the sole user. Leave empty/undefined if the device is unassigned.",
                    "type": "array",
                    "uniqueItems": true,
                    "items": {
                        "type": "string",
                        "format": "email"
                    }
                },
                "location": {
                    "description": "Site where this device is located.",
                    "type": "string"
                },
                "cost": {
                    "description": "The purchase cost of the device.",
                    "type": "number"
                },
                "value": {
                    "description": "The estimated business value of the device. The value is typically calculated as the monetary cost of the device + the value of data on the device.",
                    "type": "number"
                },
                "BYOD": {
                    "description": "Indicates if this is a BYOD device -- an employee-provided device that has access to company systems/resources.",
                    "type": "boolean",
                    "default": false
                },
                "autoSecurityPatchEnabled": {
                    "description": "Indicates if security updates are auto-installed",
                    "type": "boolean",
                    "default": false
                },
                "autoSystemPatchEnabled": {
                    "description": "Indicates if operating system updates are auto-installed",
                    "type": "boolean",
                    "default": false
                },
                "encrypted": {
                    "description": "Indicates if the primary device storage is encrypted",
                    "type": "boolean",
                    "default": false
                },
                "public": {
                    "description": "Indicates if the device is publicly accessible from the internet",
                    "type": ["boolean", "null"],
                    "default": false
                },
                "malwareProtected": {
                    "description": "Indicates if malware protection is enabled",
                    "type": "boolean",
                    "default": false
                },
                "firewallEnabled": {
                    "description": "Indicates if local/host firewall is enabled",
                    "type": "boolean",
                    "default": false
                },
                "remoteAccessEnabled": {
                    "description": "Indicates if remote access/login to the device is enabled",
                    "type": "boolean",
                    "default": false
                },
                "screenLockEnabled": {
                    "description": "Indicates if screen lock protection is enabled",
                    "type": "boolean",
                    "default": false
                },
                "screenLockTimeout": {
                    "description": "Screen lock timeout in seconds",
                    "type": "number"
                },
                "assetTag": {
                    "description": "The asset tag number/label that matches the identifier in asset tracking system, for company owned physical devices",
                    "type": "array",
                    "uniqueItems": true,
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "category",
                "displayName",
                "ipv4Addresses",
                "ipv6Addresses",
                "macAddresses",
                "publicIpAddresses",
                "privateIpAddresses",
                "hostname",
                "fqdn",
                "serial",
                "deviceId",
                "lastSeenOn",
                "make",
                "model",
                "osName",
                "osType",
                "osDetails",
                "osVersion"
            ]
        }
    ]
}
