{
  "$id": "https://elicitra.eigen.rest/developers/v6/schemas/webhooks/com.elicitra.automation.triggered.v1.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "activation": {
      "additionalProperties": false,
      "properties": {
        "executionId": {
          "maxLength": 256,
          "minLength": 1,
          "type": "string"
        },
        "matchedConditions": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "actual": {
                "anyOf": [
                  {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "expected": {
                "anyOf": [
                  {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  },
                  {
                    "type": "number"
                  }
                ]
              },
              "field": {
                "maxLength": 256,
                "minLength": 1,
                "type": "string"
              },
              "operator": {
                "enum": [
                  "gte",
                  "lte",
                  "equals",
                  "not_equals"
                ],
                "type": "string"
              },
              "source": {
                "enum": [
                  "score",
                  "classification"
                ],
                "type": "string"
              }
            },
            "required": [
              "source",
              "field",
              "operator",
              "expected",
              "actual"
            ],
            "type": "object"
          },
          "maxItems": 8,
          "type": "array"
        },
        "ruleId": {
          "maxLength": 256,
          "minLength": 1,
          "type": "string"
        },
        "ruleLabel": {
          "maxLength": 8192,
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "executionId",
        "ruleId",
        "ruleLabel",
        "matchedConditions"
      ],
      "type": "object"
    },
    "analysis": {
      "additionalProperties": false,
      "properties": {
        "analysisAnswers": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "answer": {
                "maxLength": 8192,
                "minLength": 1,
                "type": "string"
              },
              "questionKey": {
                "maxLength": 256,
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "questionKey",
              "answer"
            ],
            "type": "object"
          },
          "maxItems": 100,
          "type": "array"
        },
        "classifications": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "axisKey": {
                "maxLength": 256,
                "minLength": 1,
                "type": "string"
              },
              "value": {
                "maxLength": 8192,
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "axisKey",
              "value"
            ],
            "type": "object"
          },
          "maxItems": 100,
          "type": "array"
        },
        "configuredAnswers": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "fieldKey": {
                "maxLength": 256,
                "minLength": 1,
                "type": "string"
              },
              "status": {
                "enum": [
                  "answered",
                  "partial",
                  "missing",
                  "not_applicable"
                ],
                "type": "string"
              },
              "value": {
                "anyOf": [
                  {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  },
                  {
                    "items": {
                      "anyOf": [
                        {
                          "maxLength": 8192,
                          "minLength": 1,
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "maxItems": 100,
                    "type": "array"
                  }
                ]
              }
            },
            "required": [
              "fieldKey",
              "value",
              "status"
            ],
            "type": "object"
          },
          "maxItems": 100,
          "type": "array"
        },
        "insights": {
          "items": {
            "maxLength": 8192,
            "minLength": 1,
            "type": "string"
          },
          "maxItems": 100,
          "type": "array"
        },
        "missingFields": {
          "items": {
            "maxLength": 256,
            "minLength": 1,
            "type": "string"
          },
          "maxItems": 100,
          "type": "array"
        },
        "openQuestions": {
          "items": {
            "maxLength": 8192,
            "minLength": 1,
            "type": "string"
          },
          "maxItems": 100,
          "type": "array"
        },
        "operatorHandoff": {
          "anyOf": [
            {
              "maxLength": 8192,
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "recommendedActions": {
          "items": {
            "maxLength": 8192,
            "minLength": 1,
            "type": "string"
          },
          "maxItems": 100,
          "type": "array"
        },
        "riskNotes": {
          "items": {
            "maxLength": 8192,
            "minLength": 1,
            "type": "string"
          },
          "maxItems": 100,
          "type": "array"
        },
        "salesHandoff": {
          "anyOf": [
            {
              "maxLength": 8192,
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "scores": {
          "additionalProperties": false,
          "properties": {
            "completeness": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "intent": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "intent",
            "completeness"
          ],
          "type": "object"
        },
        "summary": {
          "anyOf": [
            {
              "maxLength": 8192,
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "summary",
        "operatorHandoff",
        "salesHandoff",
        "configuredAnswers",
        "missingFields",
        "scores",
        "classifications",
        "analysisAnswers",
        "insights",
        "recommendedActions",
        "openQuestions",
        "riskNotes"
      ],
      "type": "object"
    },
    "campaign": {
      "anyOf": [
        {
          "additionalProperties": false,
          "properties": {
            "id": {
              "maxLength": 256,
              "minLength": 1,
              "type": "string"
            },
            "name": {
              "maxLength": 8192,
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "id",
            "name"
          ],
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "consents": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "granted": {
            "type": "boolean"
          },
          "scopeKey": {
            "maxLength": 256,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "scopeKey",
          "granted"
        ],
        "type": "object"
      },
      "maxItems": 100,
      "type": "array"
    },
    "interaction": {
      "additionalProperties": false,
      "properties": {
        "channel": {
          "enum": [
            "phone",
            "web_voice",
            "text",
            "controlled_transcript"
          ],
          "type": "string"
        },
        "endedAt": {
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
          "type": "string"
        },
        "id": {
          "maxLength": 256,
          "minLength": 1,
          "type": "string"
        },
        "outcome": {
          "enum": [
            "completed",
            "cancelled",
            "failed",
            "not_connected",
            "abandoned"
          ],
          "type": "string"
        },
        "reasonCode": {
          "enum": [
            "respondent_ended",
            "platform_ended",
            "operator_cancelled",
            "no_answer",
            "busy",
            "rejected",
            "timeout",
            "technical_error",
            "unknown"
          ],
          "type": "string"
        }
      },
      "required": [
        "id",
        "channel",
        "outcome",
        "reasonCode",
        "endedAt"
      ],
      "type": "object"
    },
    "organization": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "maxLength": 256,
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "respondent": {
      "additionalProperties": false,
      "properties": {
        "email": {
          "anyOf": [
            {
              "maxLength": 320,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "name": {
          "anyOf": [
            {
              "maxLength": 8192,
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "phone": {
          "anyOf": [
            {
              "maxLength": 32,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "name",
        "email",
        "phone"
      ],
      "type": "object"
    },
    "scenario": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "maxLength": 256,
          "minLength": 1,
          "type": "string"
        },
        "name": {
          "maxLength": 8192,
          "minLength": 1,
          "type": "string"
        },
        "revision": {
          "anyOf": [
            {
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "slug": {
          "maxLength": 256,
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "id",
        "slug",
        "name",
        "revision"
      ],
      "type": "object"
    },
    "truncation": {
      "additionalProperties": false,
      "properties": {
        "omittedFields": {
          "items": {
            "maxLength": 512,
            "type": "string"
          },
          "maxItems": 100,
          "type": "array"
        },
        "truncated": {
          "type": "boolean"
        }
      },
      "required": [
        "truncated",
        "omittedFields"
      ],
      "type": "object"
    }
  },
  "required": [
    "organization",
    "interaction",
    "campaign",
    "scenario",
    "respondent",
    "consents",
    "truncation",
    "analysis",
    "activation"
  ],
  "title": "com.elicitra.automation.triggered.v1 data",
  "type": "object"
}
