{
  "$id": "https://betterstood.com/developers/v31/schemas/mcp/intelligence_query.input.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "page": {
      "maximum": 1000,
      "minimum": 1,
      "type": "integer"
    },
    "pageSize": {
      "maximum": 50,
      "minimum": 1,
      "type": "integer"
    },
    "query": {
      "oneOf": [
        {
          "additionalProperties": false,
          "properties": {
            "operation": {
              "const": "journey_count",
              "type": "string"
            }
          },
          "required": [
            "operation"
          ],
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "fieldRef": {
              "maxLength": 128,
              "minLength": 1,
              "type": "string"
            },
            "operation": {
              "const": "answer_distribution",
              "type": "string"
            }
          },
          "required": [
            "operation",
            "fieldRef"
          ],
          "type": "object"
        }
      ]
    },
    "scope": {
      "additionalProperties": false,
      "properties": {
        "campaignKey": {
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        },
        "channel": {
          "enum": [
            "ALL",
            "phone_call",
            "web_call",
            "text_chat"
          ],
          "type": "string"
        },
        "dateFrom": {
          "format": "date",
          "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])))$",
          "type": "string"
        },
        "dateTo": {
          "format": "date",
          "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])))$",
          "type": "string"
        },
        "scenarioId": {
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "scenarioId"
      ],
      "type": "object"
    }
  },
  "required": [
    "scope",
    "query"
  ],
  "title": "intelligence_query input",
  "type": "object"
}
