{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/meetdarwin-ai/json-schema/meetdarwin-ai-outcome-create-schema.json",
  "title": "OutcomeCreate",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/meetdarwin-ai-openapi.json#/components/schemas/OutcomeCreate",
  "type": "object",
  "properties": {
    "template": {
      "description": "Start from Request a quote or Request a callback; anything else you send replaces the template's.",
      "type": "string",
      "enum": [
        "quote",
        "callback"
      ]
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 60,
      "description": "The form's name, e.g. \"Request a quote\"."
    },
    "button_label": {
      "type": "string",
      "minLength": 1,
      "maxLength": 30,
      "description": "The button the agent shows above the message box when it offers the form; the name when left out."
    },
    "offer_when": {
      "type": "string",
      "minLength": 1,
      "maxLength": 400,
      "description": "When the agent opens it, finishing \"Offer it when the visitor…\", e.g. \"asks what a job would cost or wants an estimate\"."
    },
    "questions": {
      "maxItems": 7,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "description": "The question's id (f_…). Send it when you change a question so its earlier answers stay matched; leave it out for a new one.",
            "type": "string",
            "pattern": "^f_[a-z0-9]{4,16}$"
          },
          "question": {
            "description": "What the visitor is asked. Needed for a new question.",
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "type": {
            "description": "short_text (default), long_text, choice, multi_choice, number, phone, date or yes_no.",
            "type": "string",
            "enum": [
              "short_text",
              "long_text",
              "choice",
              "multi_choice",
              "number",
              "phone",
              "date",
              "yes_no"
            ]
          },
          "required": {
            "description": "Default true. Optional questions show Skip. A question with a fit rule is always required.",
            "type": "boolean"
          },
          "agent_can_fill": {
            "description": "Default true: the agent fills it in from what the visitor already said; they can change it.",
            "type": "boolean"
          },
          "choices": {
            "description": "For choice and multi_choice: 2 to 12 answers.",
            "maxItems": 12,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            }
          },
          "unit": {
            "description": "For number: shown after it, such as \"pages\".",
            "type": "string",
            "maxLength": 16
          },
          "not_a_fit": {
            "description": "Fit rule for choice, multi_choice and yes_no: answers that mean the visitor is not a fit (at least one answer must still fit).",
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            }
          },
          "min": {
            "description": "Fit rule for number: below this is not a fit. Null for no limit.",
            "type": [
              "number",
              "null"
            ]
          },
          "max": {
            "description": "Fit rule for number: above this is not a fit. Null for no limit.",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "description": "Up to 7 questions, in order. Name and email are always asked last. Replaces the whole list."
    },
    "phone": {
      "type": "string",
      "enum": [
        "off",
        "optional",
        "required"
      ],
      "description": "Whether the last step also asks for a phone number."
    },
    "then": {
      "type": "string",
      "enum": [
        "message",
        "meeting"
      ],
      "description": "After the form: show done_message, or go on to book a meeting."
    },
    "done_message": {
      "type": "string",
      "maxLength": 200,
      "description": "The thank-you the visitor sees once it is sent."
    },
    "meeting_optional": {
      "type": "boolean",
      "description": "With then: meeting, the visitor may send the request without booking."
    },
    "not_fit_message": {
      "type": "string",
      "maxLength": 200,
      "description": "Shown instead of the calendar to a visitor whose answers are not a fit."
    },
    "notify": {
      "maxItems": 5,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 3,
        "maxLength": 254
      },
      "description": "Up to 5 extra addresses that get each request by email, such as sales@."
    },
    "top_of_chat": {
      "type": "boolean",
      "description": "Put its button under the agent's name at the top of the chat, in place of Book a meeting (one at a time; a form's shows while it is live)."
    },
    "status": {
      "type": "string",
      "enum": [
        "live",
        "draft"
      ],
      "description": "live: the agent offers it to visitors. draft: saved but never offered. Default draft."
    }
  },
  "additionalProperties": false
}