{
    "$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": {
                        "device_id": {
                            "description": "Globally unique identifier for the Device which initially created the Flow. This attribute is used to ensure referential integrity by registry implementations (v1.1 onwards).",
                            "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": "Number of Grains per second for this Flow. Must be an integer division of, or equal to the Grain rate specified by the parent Source. Grain rate matches the frame rate for video (see NMOS Content Model). Specified for periodic Flows 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 Flow IDs of Grains which came together to generate this Flow (may change over the lifetime of this Flow)",
                            "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"
                        },
                        "source_id": {
                            "description": "Globally unique identifier for the Source which initially created the Flow. This attribute is used to ensure referential integrity by registry implementations (v1.0 only).",
                            "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"
                        }
                    },
                    "required": [
                        "source_id",
                        "device_id",
                        "parents"
                    ],
                    "type": "object"
                }
            ],
            "description": "Describes a Flow",
            "title": "Flow resource",
            "type": "object"
        },
        {
            "properties": {
                "format": {
                    "description": "Format of the data coming from the Flow as a URN",
                    "enum": [
                        "urn:x-nmos:format:mux"
                    ],
                    "format": "uri",
                    "type": "string"
                },
                "media_type": {
                    "anyOf": [
                        {
                            "enum": [
                                "video/SMPTE2022-6"
                            ]
                        },
                        {
                            "pattern": "^[^\\s\\/]+\\/[^\\s\\/]+$"
                        }
                    ],
                    "description": "Subclassification of the format, using IANA assigned media types where available, or other values defined in the NMOS Parameter Registers",
                    "type": "string"
                }
            },
            "required": [
                "format",
                "media_type"
            ],
            "type": "object"
        }
    ],
    "description": "Describes a mux Flow",
    "title": "Mux Flow resource",
    "type": "object"
}
