{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "allOf": [
        {
            "$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": {
                        "caps": {
                            "description": "Capabilities (not yet defined)",
                            "type": "object"
                        },
                        "clock_name": {
                            "description": "Reference to clock in the originating Node",
                            "pattern": "^clk[0-9]+$",
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "device_id": {
                            "description": "Globally unique identifier for the Device which initially created the Source. 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"
                        },
                        "grain_rate": {
                            "description": "Maximum number of Grains per second for Flows derived from this Source. Corresponding Flow Grain rates may override this attribute. Grain rate matches the frame rate for video (see NMOS Content Model). Specified for periodic Sources only.",
                            "properties": {
                                "denominator": {
                                    "default": 1,
                                    "description": "Denominator",
                                    "type": "integer"
                                },
                                "numerator": {
                                    "description": "Numerator",
                                    "type": "integer"
                                }
                            },
                            "required": [
                                "numerator"
                            ],
                            "type": "object"
                        },
                        "parents": {
                            "description": "Array of UUIDs representing the Source IDs of Grains which came together at the input to this Source (may change over the lifetime of this Source)",
                            "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"
                        }
                    },
                    "required": [
                        "caps",
                        "device_id",
                        "parents",
                        "clock_name"
                    ],
                    "type": "object"
                }
            ],
            "description": "Describes a Source",
            "title": "Source resource",
            "type": "object"
        },
        {
            "properties": {
                "channels": {
                    "description": "Array of objects describing the audio channels",
                    "items": {
                        "properties": {
                            "label": {
                                "description": "Label for this channel (free text)",
                                "type": "string"
                            },
                            "symbol": {
                                "description": "Symbol for this channel (from VSF TR-03 Appendix A)",
                                "oneOf": [
                                    {
                                        "enum": [
                                            "L",
                                            "R",
                                            "C",
                                            "LFE",
                                            "Ls",
                                            "Rs",
                                            "Lss",
                                            "Rss",
                                            "Lrs",
                                            "Rrs",
                                            "Lc",
                                            "Rc",
                                            "Cs",
                                            "HI",
                                            "VIN",
                                            "M1",
                                            "M2",
                                            "Lt",
                                            "Rt",
                                            "Lst",
                                            "Rst",
                                            "S"
                                        ]
                                    },
                                    {
                                        "description": "Numbered Source Channel",
                                        "pattern": "^NSC(0[0-9][0-9]|1[0-1][0-9]|12[0-8])$"
                                    },
                                    {
                                        "description": "Undefined channel",
                                        "pattern": "^U(0[1-9]|[1-5][0-9]|6[0-4])$"
                                    }
                                ],
                                "type": "string"
                            }
                        },
                        "required": [
                            "label"
                        ],
                        "title": "Component",
                        "type": "object"
                    },
                    "minItems": 1,
                    "type": "array"
                },
                "format": {
                    "description": "Format of the data coming from the Source as a URN",
                    "enum": [
                        "urn:x-nmos:format:audio"
                    ],
                    "format": "uri",
                    "type": "string"
                }
            },
            "required": [
                "format",
                "channels"
            ],
            "type": "object"
        }
    ],
    "description": "Describes an audio Source",
    "title": "Audio Source resource",
    "type": "object"
}
