{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Describes a bulk receiver update resource",
    "items": {
        "additionalProperties": false,
        "properties": {
            "id": {
                "description": "ID of the target receiver to apply parameters to",
                "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"
            },
            "params": {
                "$schema": "http://json-schema.org/draft-04/schema#",
                "additionalProperties": false,
                "description": "Describes a receiver",
                "properties": {
                    "activation": {
                        "$schema": "http://json-schema.org/draft-04/schema#",
                        "additionalProperties": false,
                        "description": "Parameters concerned with activation of the transport parameters",
                        "properties": {
                            "mode": {
                                "anyOf": [
                                    {
                                        "enum": [
                                            "activate_immediate",
                                            "activate_scheduled_absolute",
                                            "activate_scheduled_relative"
                                        ],
                                        "type": "string"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "Mode of activation: immediate (on message receipt), scheduled_absolute (when internal clock >= requested_time), scheduled_relative (when internal clock >= time of message receipt + requested_time), or null (no activation scheduled)"
                            },
                            "requested_time": {
                                "anyOf": [
                                    {
                                        "pattern": "^[0-9]+:[0-9]+$",
                                        "type": "string"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "description": "String formatted TAI timestamp (<seconds>:<nanoseconds>) indicating time (absolute or relative) for activation. Should be null or not present if 'mode' is null."
                            }
                        },
                        "required": [
                            "mode"
                        ],
                        "title": "Activation resource",
                        "type": "object"
                    },
                    "master_enable": {
                        "description": "Master on/off control for receiver",
                        "type": "boolean"
                    },
                    "sender_id": {
                        "description": "ID of the Sender subscribed to by this Receiver. This will be null if the receiver has not been configured to receive anything, or if it is receiving from a non-NMOS sender.",
                        "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",
                            "null"
                        ]
                    },
                    "transport_file": {
                        "$schema": "http://json-schema.org/draft-04/schema#",
                        "additionalProperties": false,
                        "description": "Transport file parameters. 'data' and 'type' must both be strings or both be null. If 'type' is non-null 'data' is expected to contain a valid instance of the specified media type.",
                        "properties": {
                            "data": {
                                "description": "Content of the transport file",
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "type": {
                                "description": "IANA assigned media type for file (e.g application/sdp)",
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        },
                        "required": [
                            "data",
                            "type"
                        ],
                        "title": "Transport file",
                        "type": "object"
                    },
                    "transport_params": {
                        "$schema": "http://json-schema.org/draft-04/schema#",
                        "anyOf": [
                            {
                                "items": {
                                    "$schema": "http://json-schema.org/draft-04/schema#",
                                    "additionalProperties": false,
                                    "description": "Describes RTP Receiver transport parameters. The constraints in this schema are minimum constraints, but may be further constrained at the constraints endpoint. Receivers must support at least the `source_ip`, `interface_ip`, `rtp_enabled` and `destination_port` parameters, and must support the `multicast_ip` parameter if they are capable of multicast operation. Receivers supporting FEC and/or RTCP must support parameters prefixed with `fec` and `rtcp` respectively.",
                                    "patternProperties": {
                                        "^ext_[a-zA-Z0-9_]+$": {
                                            "$schema": "http://json-schema.org/draft-04/schema#",
                                            "description": "Describes external Receiver transport parameters defined in other AMWA specifications. The constraints in this schema are minimum constraints, but may be further constrained at the constraints endpoint.",
                                            "title": "External Receiver Transport Parameters",
                                            "type": [
                                                "string",
                                                "boolean",
                                                "null",
                                                "number"
                                            ]
                                        }
                                    },
                                    "properties": {
                                        "destination_port": {
                                            "description": "destination port for RTP packets (auto = 5004 by default)",
                                            "maximum": 65535,
                                            "minimum": 1,
                                            "pattern": "^auto$",
                                            "type": [
                                                "integer",
                                                "string"
                                            ]
                                        },
                                        "fec1D_destination_port": {
                                            "description": "destination port for RTP Column FEC packets (auto = RTP destination_port + 2 by default)",
                                            "maximum": 65535,
                                            "minimum": 1,
                                            "pattern": "^auto$",
                                            "type": [
                                                "integer",
                                                "string"
                                            ]
                                        },
                                        "fec2D_destination_port": {
                                            "description": "destination port for RTP Row FEC packets (auto = RTP destination_port + 4 by default)",
                                            "maximum": 65535,
                                            "minimum": 1,
                                            "pattern": "^auto$",
                                            "type": [
                                                "integer",
                                                "string"
                                            ]
                                        },
                                        "fec_destination_ip": {
                                            "anyOf": [
                                                {
                                                    "format": "ipv4"
                                                },
                                                {
                                                    "format": "ipv6"
                                                },
                                                {
                                                    "pattern": "^auto$"
                                                }
                                            ],
                                            "description": "May be used if NAT is being used at the destination (auto = multicast_ip (multicast mode) or interface_ip (unicast mode) by default)",
                                            "type": "string"
                                        },
                                        "fec_enabled": {
                                            "description": "FEC on/off",
                                            "type": "boolean"
                                        },
                                        "fec_mode": {
                                            "description": "forward error correction mode to apply. (auto = highest available number of dimensions by default)",
                                            "enum": [
                                                "auto",
                                                "1D",
                                                "2D"
                                            ],
                                            "type": "string"
                                        },
                                        "interface_ip": {
                                            "anyOf": [
                                                {
                                                    "format": "ipv4"
                                                },
                                                {
                                                    "format": "ipv6"
                                                },
                                                {
                                                    "pattern": "^auto$"
                                                }
                                            ],
                                            "description": "IP address of the network interface the receiver should use. The receiver should provide an enum in the constraints endpoint, which should contain the available interface addresses. If set to auto in multicast mode the receiver should determine which interface to use for itself, for example by using the routing tables. The behaviour of auto is undefined in unicast mode, and controllers should supply a specific interface address.",
                                            "type": "string"
                                        },
                                        "multicast_ip": {
                                            "anyOf": [
                                                {
                                                    "format": "ipv4"
                                                },
                                                {
                                                    "format": "ipv6"
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ],
                                            "description": "IP multicast group address used in multicast operation only. Should be set to null during unicast operation. A null value indicates the parameter has not been configured, or the receiver is operating in unicast mode.",
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "rtcp_destination_ip": {
                                            "anyOf": [
                                                {
                                                    "format": "ipv4"
                                                },
                                                {
                                                    "format": "ipv6"
                                                },
                                                {
                                                    "pattern": "^auto$"
                                                }
                                            ],
                                            "description": "Destination IP address of RTCP packets (auto = multicast_ip (multicast mode) or interface_ip (unicast mode) by default)",
                                            "type": "string"
                                        },
                                        "rtcp_destination_port": {
                                            "description": "destination port for RTCP packets (auto = RTP destination_port + 1 by default)",
                                            "maximum": 65535,
                                            "minimum": 1,
                                            "pattern": "^auto$",
                                            "type": [
                                                "integer",
                                                "string"
                                            ]
                                        },
                                        "rtcp_enabled": {
                                            "description": "RTCP on/off",
                                            "type": "boolean"
                                        },
                                        "rtp_enabled": {
                                            "description": "RTP reception active/inactive",
                                            "type": "boolean"
                                        },
                                        "source_ip": {
                                            "anyOf": [
                                                {
                                                    "format": "ipv4"
                                                },
                                                {
                                                    "format": "ipv6"
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ],
                                            "description": "Source IP address of RTP packets in unicast mode, source filter for source specific multicast. A null value indicates that the source IP address has not been configured in unicast mode, or the Receiver is in any-source multicast mode.",
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "title": "Receiver Input",
                                    "type": "object"
                                },
                                "type": "array"
                            },
                            {
                                "items": {
                                    "not": {}
                                },
                                "type": "array"
                            },
                            {
                                "items": {
                                    "$schema": "http://json-schema.org/draft-04/schema#",
                                    "additionalProperties": false,
                                    "description": "Describes WebSocket Receiver transport parameters. The constraints in this schema are minimum constraints, but may be further constrained at the constraints endpoint. WebSocket Receivers must support all parameters in this schema.",
                                    "patternProperties": {
                                        "^ext_[a-zA-Z0-9_]+$": {
                                            "$schema": "http://json-schema.org/draft-04/schema#",
                                            "description": "Describes external Receiver transport parameters defined in other AMWA specifications. The constraints in this schema are minimum constraints, but may be further constrained at the constraints endpoint.",
                                            "title": "External Receiver Transport Parameters",
                                            "type": [
                                                "string",
                                                "boolean",
                                                "null",
                                                "number"
                                            ]
                                        }
                                    },
                                    "properties": {
                                        "connection_authorization": {
                                            "description": "Indication of whether authorization is required to make a connection. If the parameter is set to auto the Receiver should establish for itself whether authorization should be used, based on its own internal configuration.",
                                            "enum": [
                                                "auto",
                                                true,
                                                false
                                            ],
                                            "type": [
                                                "string",
                                                "boolean"
                                            ]
                                        },
                                        "connection_uri": {
                                            "anyOf": [
                                                {
                                                    "format": "uri",
                                                    "pattern": "^wss?://.*"
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ],
                                            "description": "URI hosting the WebSocket server as defined in RFC 6455 Section 3. A null value indicates that the receiver has not yet been configured.",
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "title": "Receiver Input",
                                    "type": "object"
                                },
                                "type": "array"
                            },
                            {
                                "items": {
                                    "$schema": "http://json-schema.org/draft-04/schema#",
                                    "additionalProperties": false,
                                    "description": "Describes MQTT Receiver transport parameters. The constraints in this schema are minimum constraints, but may be further constrained at the constraints endpoint. MQTT Receivers must support all parameters in this schema.",
                                    "patternProperties": {
                                        "^ext_[a-zA-Z0-9_]+$": {
                                            "$schema": "http://json-schema.org/draft-04/schema#",
                                            "description": "Describes external Receiver transport parameters defined in other AMWA specifications. The constraints in this schema are minimum constraints, but may be further constrained at the constraints endpoint.",
                                            "title": "External Receiver Transport Parameters",
                                            "type": [
                                                "string",
                                                "boolean",
                                                "null",
                                                "number"
                                            ]
                                        }
                                    },
                                    "properties": {
                                        "broker_authorization": {
                                            "description": "Indication of whether authorization is used for communication with the broker. If the parameter is set to auto the Receiver should establish for itself whether authorization should be used, based on a discovery mechanism or its own internal configuration.",
                                            "enum": [
                                                "auto",
                                                true,
                                                false
                                            ],
                                            "type": [
                                                "string",
                                                "boolean"
                                            ]
                                        },
                                        "broker_protocol": {
                                            "description": "Indication of whether TLS is used for communication with the broker. 'mqtt' indicates operation without TLS, and 'secure-mqtt' indicates use of TLS. If the parameter is set to auto the Receiver should establish for itself which protocol it should use, based on a discovery mechanism or its own internal configuration.",
                                            "enum": [
                                                "auto",
                                                "mqtt",
                                                "secure-mqtt"
                                            ],
                                            "type": "string"
                                        },
                                        "broker_topic": {
                                            "description": "The topic which MQTT messages will be received from via the MQTT broker. A null value indicates that the Receiver has not yet been configured.",
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "connection_status_broker_topic": {
                                            "description": "The topic used for MQTT status messages such as MQTT Last Will which are received via the MQTT broker. A null value indicates that the Receiver has not yet been configured, or is not using a connection status topic.",
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "source_host": {
                                            "anyOf": [
                                                {
                                                    "pattern": "^auto$"
                                                },
                                                {
                                                    "format": "hostname"
                                                },
                                                {
                                                    "format": "ipv4"
                                                },
                                                {
                                                    "format": "ipv6"
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ],
                                            "description": "Hostname or IP hosting the MQTT broker. If the parameter is set to auto the Receiver should establish for itself which broker it should use, based on a discovery mechanism or its own internal configuration. A null value indicates that the Receiver has not yet been configured.",
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "source_port": {
                                            "description": "Source port for MQTT traffic. If the parameter is set to auto the Receiver should establish for itself which broker it should use, based on a discovery mechanism or its own internal configuration.",
                                            "maximum": 65535,
                                            "minimum": 1,
                                            "pattern": "^auto$",
                                            "type": [
                                                "integer",
                                                "string"
                                            ]
                                        }
                                    },
                                    "title": "Receiver Input",
                                    "type": "object"
                                },
                                "type": "array"
                            }
                        ],
                        "description": "Transport-specific parameters. If this parameter is included in a client request it must include the same number of array elements (or 'legs') as specified in the constraints. If no changes are required to a specific leg it must be included as an empty object ({}).",
                        "title": "Receiver Transport Parameters"
                    }
                },
                "title": "Receiver resource",
                "type": "object"
            }
        },
        "required": [
            "id",
            "params"
        ],
        "type": "object"
    },
    "title": "Bulk receiver resource",
    "type": "array"
}
