{
  "$id": "https://elicitra.eigen.rest/developers/v6/schemas/mcp/scenario_update_draft.input.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "expectedRevision": {
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991,
      "type": "integer"
    },
    "idempotencyKey": {
      "maxLength": 128,
      "minLength": 8,
      "type": "string"
    },
    "operations": {
      "items": {
        "anyOf": [
          {
            "additionalProperties": false,
            "properties": {
              "confirmRemovals": {
                "const": true,
                "type": "boolean"
              },
              "profile": {
                "additionalProperties": false,
                "properties": {
                  "audience": {
                    "anyOf": [
                      {
                        "maxLength": 8192,
                        "minLength": 1,
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "purpose": {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  },
                  "tone": {
                    "anyOf": [
                      {
                        "maxLength": 8192,
                        "minLength": 1,
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "purpose"
                ],
                "type": "object"
              },
              "type": {
                "const": "set_profile",
                "type": "string"
              }
            },
            "required": [
              "type",
              "profile"
            ],
            "type": "object"
          },
          {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "assistantName": {
                    "anyOf": [
                      {
                        "description": "Optional assistant identity label. Elicitra keeps AI identity and actual recording/transcription wording server-owned.",
                        "maxLength": 256,
                        "minLength": 1,
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "language": {
                    "enum": [
                      "it-IT",
                      "en-US",
                      "es-ES",
                      "fr-FR",
                      "de-DE",
                      "hi-IN",
                      "ru-RU",
                      "pt-PT",
                      "ja-JP",
                      "nl-NL"
                    ],
                    "type": "string"
                  },
                  "name": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "type": {
                    "const": "set_metadata",
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "name"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "properties": {
                  "assistantName": {
                    "anyOf": [
                      {
                        "description": "Optional assistant identity label. Elicitra keeps AI identity and actual recording/transcription wording server-owned.",
                        "maxLength": 256,
                        "minLength": 1,
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "language": {
                    "enum": [
                      "it-IT",
                      "en-US",
                      "es-ES",
                      "fr-FR",
                      "de-DE",
                      "hi-IN",
                      "ru-RU",
                      "pt-PT",
                      "ja-JP",
                      "nl-NL"
                    ],
                    "type": "string"
                  },
                  "name": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "type": {
                    "const": "set_metadata",
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "language"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "properties": {
                  "assistantName": {
                    "anyOf": [
                      {
                        "description": "Optional assistant identity label. Elicitra keeps AI identity and actual recording/transcription wording server-owned.",
                        "maxLength": 256,
                        "minLength": 1,
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "language": {
                    "enum": [
                      "it-IT",
                      "en-US",
                      "es-ES",
                      "fr-FR",
                      "de-DE",
                      "hi-IN",
                      "ru-RU",
                      "pt-PT",
                      "ja-JP",
                      "nl-NL"
                    ],
                    "type": "string"
                  },
                  "name": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "type": {
                    "const": "set_metadata",
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "assistantName"
                ],
                "type": "object"
              }
            ]
          },
          {
            "additionalProperties": false,
            "properties": {
              "intake": {
                "additionalProperties": false,
                "properties": {
                  "ctaLabel": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "headline": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "subheadline": {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "headline",
                  "subheadline",
                  "ctaLabel"
                ],
                "type": "object"
              },
              "type": {
                "const": "set_intake",
                "type": "string"
              }
            },
            "required": [
              "type",
              "intake"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "confirmRemovals": {
                "const": true,
                "type": "boolean"
              },
              "conversation": {
                "additionalProperties": false,
                "properties": {
                  "instructions": {
                    "items": {
                      "maxLength": 400,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 12,
                    "type": "array"
                  },
                  "openingQuestion": {
                    "anyOf": [
                      {
                        "maxLength": 8192,
                        "minLength": 1,
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "type": "object"
              },
              "type": {
                "const": "set_conversation",
                "type": "string"
              }
            },
            "required": [
              "type",
              "conversation"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "confirmRemovals": {
                "const": true,
                "type": "boolean"
              },
              "field": {
                "additionalProperties": false,
                "properties": {
                  "collection": {
                    "additionalProperties": false,
                    "properties": {
                      "form": {
                        "additionalProperties": false,
                        "properties": {
                          "help_text": {
                            "maxLength": 240,
                            "type": "string"
                          },
                          "max_date": {
                            "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"
                          },
                          "max_number": {
                            "type": "number"
                          },
                          "min_date": {
                            "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"
                          },
                          "min_number": {
                            "type": "number"
                          },
                          "number_step": {
                            "exclusiveMinimum": 0,
                            "type": "number"
                          }
                        },
                        "type": "object"
                      },
                      "mode": {
                        "enum": [
                          "conversation",
                          "form"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "mode"
                    ],
                    "type": "object"
                  },
                  "followupGuidance": {
                    "default": [],
                    "items": {
                      "maxLength": 8192,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  },
                  "goodAnswerExamples": {
                    "default": [],
                    "items": {
                      "maxLength": 8192,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  },
                  "key": {
                    "pattern": "^[a-z][a-z0-9_]{1,63}$",
                    "type": "string"
                  },
                  "label": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "options": {
                    "anyOf": [
                      {
                        "items": {
                          "maxLength": 256,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 100,
                        "type": "array"
                      },
                      {
                        "items": {
                          "additionalProperties": false,
                          "properties": {
                            "label": {
                              "maxLength": 256,
                              "minLength": 1,
                              "type": "string"
                            },
                            "value": {
                              "maxLength": 256,
                              "minLength": 1,
                              "type": "string"
                            }
                          },
                          "required": [
                            "value",
                            "label"
                          ],
                          "type": "object"
                        },
                        "maxItems": 100,
                        "type": "array"
                      }
                    ]
                  },
                  "primaryQuestion": {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "stopCondition": {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  },
                  "type": {
                    "enum": [
                      "text",
                      "number",
                      "currency",
                      "boolean",
                      "select",
                      "date",
                      "email",
                      "phone"
                    ],
                    "type": "string"
                  },
                  "weakAnswerExamples": {
                    "default": [],
                    "items": {
                      "maxLength": 8192,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  }
                },
                "required": [
                  "key",
                  "label",
                  "type",
                  "required",
                  "primaryQuestion"
                ],
                "type": "object"
              },
              "type": {
                "const": "upsert_field",
                "type": "string"
              }
            },
            "required": [
              "type",
              "field"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "confirmRemovals": {
                "const": true,
                "type": "boolean"
              },
              "key": {
                "pattern": "^[a-z][a-z0-9_]{1,63}$",
                "type": "string"
              },
              "type": {
                "const": "remove_field",
                "type": "string"
              }
            },
            "required": [
              "type",
              "key",
              "confirmRemovals"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "fieldKeys": {
                "items": {
                  "pattern": "^[a-z][a-z0-9_]{1,63}$",
                  "type": "string"
                },
                "maxItems": 100,
                "minItems": 1,
                "type": "array"
              },
              "type": {
                "const": "reorder_fields",
                "type": "string"
              }
            },
            "required": [
              "type",
              "fieldKeys"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "confirmRemovals": {
                "const": true,
                "type": "boolean"
              },
              "outputs": {
                "additionalProperties": false,
                "properties": {
                  "handoffLabel": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "requiredSections": {
                    "items": {
                      "maxLength": 256,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 50,
                    "type": "array"
                  },
                  "summaryLabel": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "summaryLabel",
                  "handoffLabel",
                  "requiredSections"
                ],
                "type": "object"
              },
              "type": {
                "const": "set_outputs",
                "type": "string"
              }
            },
            "required": [
              "type",
              "outputs"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "confirmRemovals": {
                "const": true,
                "type": "boolean"
              },
              "scoring": {
                "additionalProperties": false,
                "properties": {
                  "completenessEnabled": {
                    "type": "boolean"
                  },
                  "completenessLabel": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "completenessThreshold": {
                    "maximum": 5,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "intentEnabled": {
                    "type": "boolean"
                  },
                  "intentLabel": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "intentThreshold": {
                    "maximum": 5,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "qualificationMatch": {
                    "enum": [
                      "all",
                      "any"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "intentEnabled",
                  "intentLabel",
                  "completenessEnabled",
                  "completenessLabel",
                  "qualificationMatch",
                  "intentThreshold",
                  "completenessThreshold"
                ],
                "type": "object"
              },
              "type": {
                "const": "set_scoring",
                "type": "string"
              }
            },
            "required": [
              "type",
              "scoring"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "analysis": {
                "additionalProperties": false,
                "properties": {
                  "analysisQuestions": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "key": {
                          "pattern": "^[a-z][a-z0-9_]{1,63}$",
                          "type": "string"
                        },
                        "question": {
                          "maxLength": 8192,
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "key",
                        "question"
                      ],
                      "type": "object"
                    },
                    "maxItems": 20,
                    "type": "array"
                  },
                  "classificationAxes": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "key": {
                          "pattern": "^[a-z][a-z0-9_]{1,63}$",
                          "type": "string"
                        },
                        "label": {
                          "maxLength": 256,
                          "minLength": 1,
                          "type": "string"
                        },
                        "values": {
                          "items": {
                            "maxLength": 256,
                            "minLength": 1,
                            "type": "string"
                          },
                          "maxItems": 12,
                          "minItems": 1,
                          "type": "array"
                        }
                      },
                      "required": [
                        "key",
                        "label",
                        "values"
                      ],
                      "type": "object"
                    },
                    "maxItems": 12,
                    "type": "array"
                  },
                  "style": {
                    "enum": [
                      "lead_qualification",
                      "qualitative_research",
                      "diagnostic_intake",
                      "hybrid"
                    ],
                    "type": "string"
                  }
                },
                "type": "object"
              },
              "confirmRemovals": {
                "const": true,
                "type": "boolean"
              },
              "type": {
                "const": "set_analysis",
                "type": "string"
              }
            },
            "required": [
              "type",
              "analysis"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "confirmRemovals": {
                "const": true,
                "type": "boolean"
              },
              "liveFit": {
                "additionalProperties": false,
                "properties": {
                  "gates": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "askEarly": {
                          "type": "boolean"
                        },
                        "closingMessage": {
                          "maxLength": 1000,
                          "minLength": 1,
                          "type": "string"
                        },
                        "comparisonMode": {
                          "enum": [
                            "exact",
                            "semantic"
                          ],
                          "type": "string"
                        },
                        "confirmation": {
                          "enum": [
                            "only_if_ambiguous",
                            "required_on_mismatch"
                          ],
                          "type": "string"
                        },
                        "description": {
                          "maxLength": 500,
                          "type": "string"
                        },
                        "fieldKey": {
                          "pattern": "^[a-z][a-z0-9_]{1,63}$",
                          "type": "string"
                        },
                        "id": {
                          "pattern": "^[a-z][a-z0-9_]{1,63}$",
                          "type": "string"
                        },
                        "label": {
                          "maxLength": 256,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxClarifications": {
                          "anyOf": [
                            {
                              "const": 0,
                              "type": "number"
                            },
                            {
                              "const": 1,
                              "type": "number"
                            }
                          ]
                        },
                        "operator": {
                          "enum": [
                            "equals",
                            "not_equals",
                            "in",
                            "not_in"
                          ],
                          "type": "string"
                        },
                        "preansweredMismatch": {
                          "enum": [
                            "block_before_start",
                            "confirm_live"
                          ],
                          "type": "string"
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "values": {
                          "items": {
                            "anyOf": [
                              {
                                "maxLength": 1000,
                                "minLength": 1,
                                "type": "string"
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "boolean"
                              }
                            ]
                          },
                          "maxItems": 100,
                          "minItems": 1,
                          "type": "array"
                        }
                      },
                      "required": [
                        "id",
                        "label",
                        "fieldKey",
                        "operator",
                        "values",
                        "comparisonMode",
                        "askEarly",
                        "required",
                        "confirmation",
                        "maxClarifications",
                        "preansweredMismatch",
                        "closingMessage"
                      ],
                      "type": "object"
                    },
                    "maxItems": 10,
                    "type": "array"
                  },
                  "schemaVersion": {
                    "const": "live-fit.v1",
                    "type": "string"
                  }
                },
                "required": [
                  "schemaVersion",
                  "gates"
                ],
                "type": "object"
              },
              "type": {
                "const": "set_live_fit",
                "type": "string"
              }
            },
            "required": [
              "type",
              "liveFit"
            ],
            "type": "object"
          }
        ]
      },
      "maxItems": 100,
      "minItems": 1,
      "type": "array"
    },
    "scenarioId": {
      "maxLength": 128,
      "minLength": 1,
      "type": "string"
    }
  },
  "required": [
    "idempotencyKey",
    "scenarioId",
    "expectedRevision",
    "operations"
  ],
  "title": "scenario_update_draft input",
  "type": "object"
}
