{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "description": "Describes a sender",
    "title": "Sender resource",
    "additionalProperties": false,
    "properties": {
        "receiver_id": {
            "description": "ID of the target Receiver of this Sender. This will be null if the sender is operating in multicast mode, or has not been assigned a receiver in unicast mode, or is sending to a non-NMOS receiver in unicast mode.",
            "type": [
                "string",
                "null"
            ],
            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
        },
        "master_enable": {
            "description": "Master on/off control for sender",
            "type": "boolean"
        },
        "activation":{
            "description": "Parameters concerned with activation of the transport parameters",
            "type": "object",
            "additionalProperties": false,
            "properties":{
                "mode": {
                    "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)",
                    "type": [
                        "string",
                        "null"
                    ],
                    "enum": [
                        "activate_immediate",
                        "activate_scheduled_absolute",
                        "activate_scheduled_relative",
                        null
                    ]
                },
                "requested_time": {
                    "description": "String formatted TAI timestamp (<seconds>:<nanoseconds>) indicating time (absolute or relative) for activation",
                    "type": [
                        "string",
                        "null"
                    ],
                    "pattern": "^[0-9]+:[0-9]+$"
                }
            }
        },
        "transport_params": {
            "description": "Transport-specific parameters",
            "oneOf": [
                {
                    "type": "array",
                    "description": "Describes RTP Sender transport parameters. The constraints in this schema are minimum constraints, but may be further constrained at the constraints endpoint.",
                    "items": {
                        "type": "object",
                        "title": "Sender Output",
                        "additionalProperties": false,
                        "properties": {
                            "source_ip": {
                                "type": "string",
                                "description": "IP address from which RTP packets will be sent (IP address of interface bound to this output)",
                                "anyOf": [
                                    {
                                        "format": "ipv4"
                                    },
                                    {
                                        "format": "ipv6"
                                    },
                                    {
                                        "pattern": "^auto$"
                                    }
                                ],
                                "default": "auto"
                            },
                            "destination_ip": {
                                "type": "string",
                                "description": "IP address to which RTP packets will be sent",
                                "anyOf": [
                                    {
                                        "format": "ipv4"
                                    },
                                    {
                                        "format": "ipv6"
                                    },
                                    {
                                        "pattern": "^auto$"
                                    }
                                ]
                            },
                            "source_port": {
                                "type": [
                                    "integer",
                                    "string"
                                ],
                                "description": "source port for RTP packets",
                                "minimum": 0,
                                "maximum": 65535,
                                "pattern": "^auto$",
                                "default": "auto"
                            },
                            "destination_port": {
                                "type": "integer",
                                "description": "destination port for RTP packets",
                                "minimum": 1,
                                "maximum": 65535,
                                "default": 5004
                            },
                            "fec_enabled": {
                                "type": "boolean",
                                "description": "FEC on/off",
                                "default": false
                            },
                            "fec_destination_ip": {
                                "type": "string",
                                "description": "May be used if NAT is being used at the destination (auto = rtp_dest_ip)",
                                "anyOf": [
                                    {
                                        "format": "ipv4"
                                    },
                                    {
                                        "format": "ipv6"
                                    },
                                    {
                                        "pattern": "^auto$"
                                    }
                                ],
                                "default": "auto"
                            },
                            "fec_type": {
                                "type": "string",
                                "description": "forward error correction mode to apply",
                                "enum": [
                                    "XOR",
                                    "Reed-Solomon"
                                ],
                                "default": "XOR"
                            },
                            "fec_mode": {
                                "type": "string",
                                "description": "forward error correction mode to apply",
                                "enum": [
                                    "1D",
                                    "2D"
                                ],
                                "default": "1D"
                            },
                            "fec_block_width": {
                                "type": "integer",
                                "description": "width of block over which FEC is calculated in packets",
                                "minimum": 4,
                                "maximum": 200,
                                "default": 4
                            },
                            "fec_block_height": {
                                "type": "integer",
                                "description": "height of block over which FEC is calculated in packets",
                                "minimum": 4,
                                "maximum": 200,
                                "default": 4
                            },
                            "fec1D_destination_port": {
                                "type": [
                                    "integer",
                                    "string"
                                ],
                                "description": "destination port for RTP Column FEC packets (auto = RTP dest_port+2)",
                                "minimum": 1,
                                "maximum": 65535,
                                "pattern": "^auto$",
                                "default": "auto"
                            },
                            "fec2D_destination_port": {
                                "type": [
                                    "integer",
                                    "string"
                                ],
                                "description": "destination port for RTP Row FEC packets (auto = RTP dest_port+4)",
                                "minimum": 1,
                                "maximum": 65535,
                                "pattern": "^auto$",
                                "default": "auto"
                            },
                            "fec1D_source_port": {
                                "type": [
                                    "integer",
                                    "string"
                                ],
                                "description": "source port for RTP FEC packets (auto = generated by server)",
                                "minimum": 0,
                                "maximum": 65535,
                                "pattern": "^auto$",
                                "default": "auto"
                            },
                            "fec2D_source_port": {
                                "type": [
                                    "integer",
                                    "string"
                                ],
                                "description": "source port for RTP FEC packets (auto = generated by server)",
                                "minimum": 0,
                                "maximum": 65535,
                                "pattern": "^auto$",
                                "default": "auto"
                            },
                            "rtcp_enabled": {
                                "type": "boolean",
                                "description": "rtcp on/off"
                            },
                            "rtcp_destination_ip": {
                                "type": "string",
                                "description": "IP address to which RTCP packets will be sent (auto = same as RTP dest_ip)",
                                "anyOf": [
                                    {
                                        "format": "ipv4"
                                    },
                                    {
                                        "format": "ipv6"
                                    },
                                    {
                                        "pattern": "^auto$"
                                    }
                                ],
                                "default": "auto"
                            },
                            "rtcp_destination_port": {
                                "type": [
                                    "integer",
                                    "string"
                                ],
                                "description": "destination port for RTCP packets",
                                "minimum": 1,
                                "maximum": 65535,
                                "pattern": "^auto$",
                                "default": "auto"
                            },
                            "rtcp_source_port": {
                                "type": [
                                    "integer",
                                    "string"
                                ],
                                "description": "source port for RTCP packets. (auto = generated by server)",
                                "minimum": 0,
                                "maximum": 65535,
                                "pattern": "^auto$",
                                "default": "auto"
                            },
                            "rtp_enabled": {
                                "type": "boolean",
                                "description": "RTP transmission active/inactive",
                                "default": true
                            }
                        }
                    },
                    "maxItems": 2
                }

            ]
        }
    }
}
