{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "additionalProperties": false,
    "type": "object",
    "properties": {
        "nameTemplate": {
            "title": "Command Name Template",
            "type": "string",
            "minLength": 1
        },
        "payloadTemplate": {
            "title": "Command Payload Template",
            "type": "string"
        },
        "sendToDeviceTags": {
            "title": "Send to Device Tags",
            "type": "array",
            "minItems": 1,
            "items": {
                "title": "Device Tag Pair",
                "type": "object",
                "properties": {
                    "key": {
                        "type": "string"
                    },
                    "value": {
                        "type": "string"
                    }
                },
                "minLength": 1
            }
        },
        "sendToDeviceIds": {
            "title": "Send to Device IDs",
            "type": "array",
            "minItems": 1,
            "items": {
                "title": "Device ID",
                "type": "string",
                "minLength": 1
            }
        }
    },
    "allOf": [
        {
            "required": [
                "nameTemplate"
            ]
        },
        {
            "anyOf": [
                {
                    "required": [
                        "sendToDeviceIds"
                    ]
                },
                {
                    "required": [
                        "sendToDeviceTags"
                    ]
                }
            ]
        }
    ]
}