{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "#Host",
    "description": "A Host represents a computer, virtual machine, or other device that can run software and connect to a network.",
    "type": "object",
    "allOf": [
        {
            "$ref": "#Entity"
        },
        {
            "properties": {
                "category": {
                    "description": "The host category",
                    "type": [
                        "string",
                        "null"
                    ],
                    "examples": [
                        "server",
                        "endpoint",
                        "storage-media",
                        "mobile",
                        "network",
                        "other"
                    ]
                },
                "displayName": {
                    "description": "The display name of the host",
                    "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 host 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 host 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 host, e.g. Apple Inc., Generic",
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "model": {
                    "description": "Same as hardwareModel: The host 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",
                    "oneOf": [
                        {
                            "type": "string",
                            "enum": [
                                "assigned",
                                "archived",
                                "decommissioned",
                                "defective",
                                "deployed",
                                "disposed",
                                "locked",
                                "lost/stolen",
                                "pending",
                                "ready",
                                "unknown",
                                "other"
                            ]
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "public": {
                    "description": "Indicates if the host is publicly accessible from the internet",
                    "type": ["boolean", "null"],
                    "default": false
                }
            },
            "required": [
                "category",
                "displayName",
                "ipv4Addresses",
                "ipv6Addresses",
                "macAddresses",
                "publicIpAddresses",
                "privateIpAddresses",
                "hostname",
                "fqdn",
                "serial",
                "deviceId",
                "lastSeenOn",
                "make",
                "model",
                "osName",
                "osType",
                "osDetails",
                "osVersion"
            ]
        }
    ]
}
