{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.whispir.com/sparx-message-transactions/request-1.0.0",
  "title": "Sparx Message Transactions requested",
  "description": "A schema for a sparx message transaction that has been requested",
  "type": "object",
  "properties": {
    "schema": {
      "type": "string"
    },
    "metadata": {
      "$ref": "../event-0.0.0#/$defs/metadata"
    },
    "source": {
      "$ref": "../event-0.0.0#/$defs/appDetails"
    },
    "event": {
      "type": "object",
      "properties": {
        "eventType": {
          "type": "string",
          "enum": ["MESSAGE_TRANSACTION_REQUEST"]
        },
        "message": {
          "type": "object",
          "properties": {
            "user": {
              "userId": { "type": "string" },
              "accountId": { "type": "string" },
              "planId": { "type": "string" }
            },
            "sms": {
              "to": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "subject": { "type": "string" },
              "body": { "type": "string" }
            },
            "email": {
              "to": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "subject": { "type": "string" },
              "body": { "type": "string" }
            },
            "contentId": { "type": "string" },
            "recipients": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "messageRequestId": {
              "type": "string"
            }
          },
          "required": ["user", "messageRequestId"],
          "anyOf": [{ "required": ["sms"] }, { "required": ["email"] }]
        }
      },
      "required": ["eventType", "message"]
    }
  },
  "required": ["schema", "metadata", "source", "event"]
}
