{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "definitions": {
        "accountSid": {
            "title": "Account Sid",
            "type": "string",
            "minLength": 1,
            "messages": {
                "required": "Account Sid is required"
            }
        },
        "authToken": {
            "title": "Auth Token",
            "type": "string",
            "minLength": 1,
            "messages": {
                "required": "Auth Token is required"
            }
        },
        "toNumbers": {
            "title": "Send to ...",
            "type": "array",
            "items": {
                "title": "SMS Number",
                "type": "string"
            },
            "minItems": 1
        },
        "fromNumber": {
            "title": "From Number Template",
            "type": "string",
            "minLength": 1
        },
        "messagingServiceSid": {
            "title": "Messaging Service Sid Template",
            "type": "string",
            "minLength": 1
        },
        "bodyTemplate": {
            "title": "Body Template",
            "type": "string",
            "minLength": 1
        },
        "mediaUrl": {
            "title": "Media URL",
            "type": "string",
            "minLength": 1,
            "format": "uri"
        },
        "maxPrice": {
            "title": "Max. Price Template",
            "type": "string"
        }
    },
    "oneOf": [
        {
            "properties": {
                "accountSid": {
                    "$ref": "#/definitions/accountSid"
                },
                "authToken": {
                    "$ref": "#/definitions/authToken"
                },
                "toNumbers": {
                    "$ref": "#/definitions/toNumbers"
                },
                "fromNumber": {
                    "$ref": "#/definitions/fromNumber"
                },
                "bodyTemplate": {
                    "$ref": "#/definitions/bodyTemplate"
                },
                "mediaUrl": {
                    "$ref": "#/definitions/mediaUrl"
                },
                "maxPrice": {
                    "$ref": "#/definitions/maxPrice"
                }
            },
            "allOf": [
                {
                    "required": [
                        "accountSid",
                        "authToken",
                        "toNumbers",
                        "fromNumber"
                    ]
                },
                {
                    "anyOf": [
                        {
                            "required": [
                                "bodyTemplate"
                            ]
                        },
                        {
                            "required": [
                                "mediaUrl"
                            ]
                        }
                    ]
                }
            ],
            "additionalProperties": false
        },
        {
            "properties": {
                "accountSid": {
                    "$ref": "#/definitions/accountSid"
                },
                "authToken": {
                    "$ref": "#/definitions/authToken"
                },
                "toNumbers": {
                    "$ref": "#/definitions/toNumbers"
                },
                "messagingServiceSid": {
                    "$ref": "#/definitions/messagingServiceSid"
                },
                "bodyTemplate": {
                    "$ref": "#/definitions/bodyTemplate"
                },
                "mediaUrl": {
                    "$ref": "#/definitions/mediaUrl"
                },
                "maxPrice": {
                    "$ref": "#/definitions/maxPrice"
                }
            },
            "allOf": [
                {
                    "required": [
                        "accountSid",
                        "authToken",
                        "toNumbers",
                        "messagingServiceSid"
                    ]
                },
                {
                    "anyOf": [
                        {
                            "required": [
                                "bodyTemplate"
                            ]
                        },
                        {
                            "required": [
                                "mediaUrl"
                            ]
                        }
                    ]
                }
            ],
            "additionalProperties": false
        }
    ]
}