{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "additionalProperties": false,
    "allOf": [
        {
            "required": [
                "bodyTemplate",
                "subjectTemplate",
                "fromTemplate",
                "sendgridApiKey"
            ]
        },
        {
            "anyOf": [
                {
                    "required": [
                        "toAddresses"
                    ]
                },
                {
                    "required": [
                        "ccAddresses"
                    ]
                },
                {
                    "required": [
                        "bccAddresses"
                    ]
                }
            ]
        }
    ],
    "properties": {
        "bccAddresses": {
            "items": {
                "_format": "email",
                "minLength": 1,
                "title": "Email Address",
                "type": "string"
            },
            "minItems": 1,
            "title": "BCC Addresses",
            "type": "array"
        },
        "bodyTemplate": {
            "minLength": 1,
            "title": "Body Template",
            "type": "string"
        },
        "ccAddresses": {
            "items": {
                "_format": "email",
                "minLength": 1,
                "title": "Email Address",
                "type": "string"
            },
            "minItems": 1,
            "title": "CC Addresses",
            "type": "array"
        },
        "fromTemplate": {
            "minLength": 1,
            "title": "From Template",
            "type": "string"
        },
        "replyToTemplate": {
            "minLength": 1,
            "title": "Reply-To Template",
            "type": "string"
        },
        "resultPath": {
            "description": "JSON path to store SendGrid response",
            "minLength": 1,
            "title": "Result Path",
            "type": "string"
        },
        "sendgridApiKey": {
            "minLength": 1,
            "title": "SendGrid API Key",
            "type": "string"
        },
        "subjectTemplate": {
            "minLength": 1,
            "title": "Subject Template",
            "type": "string"
        },
        "toAddresses": {
            "items": {
                "_format": "email",
                "minLength": 1,
                "title": "Email Address",
                "type": "string"
            },
            "minItems": 1,
            "title": "To Addresses",
            "type": "array"
        }
    },
    "type": "object"
}