{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/semilattice-ai/json-schema/semilattice-ai-update-plan-body-schema.json",
  "title": "UpdatePlanBody",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/semilattice-ai-openapi.json#/components/schemas/UpdatePlanBody",
  "properties": {
    "question_text": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Question Text",
      "description": "The simulation's title"
    },
    "hypothesis_text": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Hypothesis Text",
      "description": "What you expect the answers to show"
    },
    "survey_questions": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/SurveyQuestionIn"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Survey Questions",
      "description": "Replaces the whole question set. Every question gets a new id, so ids from an earlier read are stale afterwards. Cannot be combined with question_edits, add_questions or delete_question_ids."
    },
    "question_edits": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/QuestionEditIn"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Question Edits",
      "description": "Change particular questions by id. Only the fields sent change; every other question keeps its id."
    },
    "add_questions": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/SurveyQuestionIn"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Add Questions",
      "description": "Questions appended after the existing ones."
    },
    "delete_question_ids": {
      "anyOf": [
        {
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Delete Question Ids",
      "description": "Ids of questions to delete."
    },
    "journey_task": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Journey Task",
      "description": "Replaces the journey task. Its shape depends on the goal: see journey_task_shape on the goal in /v1/simulation-schema."
    }
  },
  "type": "object",
  "$defs": {
    "QuestionEditIn": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id",
          "description": "The question's id, from `GET /v1/simulations/{id}`"
        },
        "question_text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Question Text",
          "description": "The question, asked exactly as written"
        },
        "question_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Question Type",
          "description": "How the question is answered: 'single_choice' picks one of answer_options"
        },
        "answer_options": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Answer Options",
          "description": "The answers to choose from, in order, e.g. from 'Very unlikely' to 'Very likely'"
        },
        "insight": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Insight",
          "description": "What the answers to this question tell you"
        },
        "variable_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Variable Name",
          "description": "A short snake_case name for the question, e.g. 'likelihood_to_switch'"
        },
        "order": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Order",
          "description": "The question's position in the plan, from 0"
        },
        "question_text_local": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Question Text Local",
          "description": "The question in the user model's own language, for a non-English user model. This is what respondents are asked; the English is kept alongside. Sent without question_text, the English is translated from it."
        },
        "answer_options_local": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Answer Options Local",
          "description": "The answer options in the user model's own language, in the same order and the same count as answer_options."
        }
      },
      "type": "object",
      "required": [
        "id"
      ],
      "title": "QuestionEditIn"
    },
    "SurveyQuestionIn": {
      "properties": {
        "question_text": {
          "type": "string",
          "title": "Question Text",
          "description": "The question, asked exactly as written"
        },
        "question_type": {
          "type": "string",
          "title": "Question Type",
          "description": "How the question is answered: 'single_choice' picks one of answer_options",
          "default": "single_choice"
        },
        "answer_options": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Answer Options",
          "description": "The answers to choose from, in order, e.g. from 'Very unlikely' to 'Very likely'"
        },
        "insight": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Insight",
          "description": "What the answers to this question tell you"
        },
        "variable_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Variable Name",
          "description": "A short snake_case name for the question, e.g. 'likelihood_to_switch'"
        },
        "question_text_local": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Question Text Local",
          "description": "The question in the user model's own language, for a non-English user model. This is what respondents are asked; the English is kept alongside."
        },
        "answer_options_local": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Answer Options Local",
          "description": "The answer options in the user model's own language, in the same order and the same count as answer_options."
        }
      },
      "type": "object",
      "required": [
        "question_text"
      ],
      "title": "SurveyQuestionIn"
    }
  }
}