{
  "type": "object",
  "properties": {
    "action": {
      "type": "string"
    },
    "debug": {
      "type": "boolean"
    },
    "options": {
      "type": "object",
      "additionalProperties": true
    },
    "data": {
      "type": "object",
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "integer"
          },
          {
            "type": "boolean"
          },
          {
            "type": "number"
          },
          {
            "type": "object",
            "additionalProperties": true
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          {
            "type": "object",
            "nullable": true,
            "description": "Must be null"
          }
        ]
      }
    },
    "target": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "entity_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "device_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "area_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "floor_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "label_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "email": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "phone": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "mobile_app_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "person_id": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "additionalProperties": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ]
    },
    "target_required": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string",
          "enum": [
            "always",
            "never",
            "optional"
          ]
        }
      ]
    },
    "target_usage": {
      "type": "string",
      "enum": [
        "no_delivery",
        "no_action",
        "merge_delivery",
        "merge_always",
        "fixed"
      ]
    },
    "inclusion": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "fallback_on_error",
          "explicit",
          "scenario",
          "default",
          "fallback"
        ]
      }
    },
    "priority": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "string"
          },
          {
            "type": "string",
            "enum": [
              "minimum",
              "low",
              "medium",
              "high",
              "critical"
            ]
          }
        ]
      }
    },
    "selection_rank": {
      "type": "string",
      "enum": [
        "ANY",
        "FIRST",
        "LAST"
      ]
    },
    "alias": {
      "type": "string"
    },
    "template": {
      "type": "string"
    },
    "message": {
      "type": "string",
      "nullable": true
    },
    "title": {
      "type": "string",
      "nullable": true
    },
    "occupancy": {
      "type": "string",
      "enum": [
        "all_in",
        "all_out",
        "any_in",
        "any_out",
        "only_in",
        "only_out",
        "all",
        "none"
      ]
    },
    "conditions": {
      "type": "array",
      "items": {
        "nullable": true,
        "type": "string"
      }
    },
    "transport": {
      "type": "string",
      "enum": [
        "sms",
        "mqtt",
        "alexa_devices",
        "alexa_media_player",
        "mobile_push",
        "chime",
        "email",
        "media",
        "persistent",
        "tts",
        "generic",
        "notify_entity",
        "ntfy",
        "gotify",
        "telegram",
        "lametric",
        "pushover",
        "html5",
        "matrix",
        "kodi",
        "discord"
      ]
    },
    "enabled": {
      "type": "boolean"
    }
  },
  "required": [
    "transport"
  ],
  "additionalProperties": false,
  "title": "Delivery Definition",
  "$id": "https://supernotify.rhizomatics.org.uk/developer/schemas/json/Delivery_Definition.schema.json",
  "description": "Voluptuous validation schema for Delivery_Definition",
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}