{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "allOf": [
        {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "description": "Describes the foundations of all NMOS resources",
            "properties": {
                "description": {
                    "description": "Detailed description of the resource",
                    "type": "string"
                },
                "id": {
                    "description": "Globally unique identifier for the resource",
                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                    "type": "string"
                },
                "label": {
                    "description": "Freeform string label for the resource",
                    "type": "string"
                },
                "tags": {
                    "description": "Key value set of freeform string tags to aid in filtering resources. Values should be represented as an array of strings. Can be empty.",
                    "patternProperties": {
                        "": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    },
                    "type": "object"
                },
                "version": {
                    "description": "String formatted TAI timestamp (<seconds>:<nanoseconds>) indicating precisely when an attribute of the resource last changed",
                    "pattern": "^[0-9]+:[0-9]+$",
                    "type": "string"
                }
            },
            "required": [
                "id",
                "version",
                "label",
                "description",
                "tags"
            ],
            "title": "Base resource",
            "type": "object"
        },
        {
            "properties": {
                "controls": {
                    "description": "Control endpoints exposed for the Device",
                    "items": {
                        "properties": {
                            "authorization": {
                                "default": false,
                                "description": "This endpoint requires authorization",
                                "type": "boolean"
                            },
                            "href": {
                                "description": "URL to reach a control endpoint, whether http or otherwise",
                                "format": "uri",
                                "type": "string"
                            },
                            "type": {
                                "description": "URN identifying the control format",
                                "format": "uri",
                                "type": "string"
                            }
                        },
                        "required": [
                            "href",
                            "type"
                        ],
                        "type": "object"
                    },
                    "type": "array"
                },
                "node_id": {
                    "description": "Globally unique identifier for the Node which initially created the Device. This attribute is used to ensure referential integrity by registry implementations.",
                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                    "type": "string"
                },
                "receivers": {
                    "description": "UUIDs of Receivers attached to the Device (deprecated)",
                    "items": {
                        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                        "type": "string"
                    },
                    "type": "array"
                },
                "senders": {
                    "description": "UUIDs of Senders attached to the Device (deprecated)",
                    "items": {
                        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                        "type": "string"
                    },
                    "type": "array"
                },
                "type": {
                    "description": "Device type URN",
                    "format": "uri",
                    "oneOf": [
                        {
                            "pattern": "^urn:x-nmos:device:"
                        },
                        {
                            "not": {
                                "pattern": "^urn:x-nmos:"
                            }
                        }
                    ],
                    "type": "string"
                }
            },
            "required": [
                "type",
                "node_id",
                "senders",
                "receivers",
                "controls"
            ],
            "type": "object"
        }
    ],
    "description": "Describes a Device",
    "title": "Device resource",
    "type": "object"
}
