{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/formasty-com/json-schema/formasty-com-draft-mutation-response-schema.json",
  "title": "DraftMutationResponse",
  "description": "Updated draft fragment with draft_revision and draft_updated_at.",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/formasty-com-openapi.json#/components/schemas/DraftMutationResponse",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "draft_revision",
    "draft_updated_at"
  ],
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "step": {
      "type": "object",
      "additionalProperties": true
    },
    "steps": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/OrderedItem"
      }
    },
    "field": {
      "type": "object",
      "additionalProperties": true
    },
    "fields": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/OrderedItem"
      }
    },
    "logic": {
      "type": "object",
      "additionalProperties": true
    },
    "rule": {
      "oneOf": [
        {
          "$ref": "#/$defs/WorkflowRule"
        },
        {
          "type": "null"
        }
      ]
    },
    "quiz": {
      "oneOf": [
        {
          "$ref": "#/$defs/QuizConfig"
        },
        {
          "type": "null"
        }
      ]
    },
    "screen": {
      "$ref": "#/$defs/ThankYouScreen"
    },
    "theme": {
      "type": "object",
      "additionalProperties": true
    },
    "asset": {
      "$ref": "#/$defs/GeneratedImageAsset"
    },
    "attached": {
      "type": "boolean"
    },
    "deleted_step_id": {
      "type": "string"
    },
    "deleted_field_id": {
      "type": "string"
    },
    "deleted_screen_id": {
      "type": "string"
    },
    "draft_revision": {
      "type": "integer",
      "minimum": 0
    },
    "draft_updated_at": {
      "type": "integer"
    }
  },
  "$defs": {
    "GeneratedImageAsset": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "id",
        "url"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "contentType": {
          "type": "string"
        },
        "size": {
          "type": "integer"
        }
      }
    },
    "OrderedItem": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "position"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "position": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "QuizConfig": {
      "type": "object",
      "additionalProperties": true,
      "description": "Builder-compatible quiz config. Supports match/personality quizzes and score quizzes.",
      "required": [
        "type",
        "enabled"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "match",
            "score"
          ]
        },
        "mode": {
          "type": "string",
          "enum": [
            "match",
            "personality"
          ]
        },
        "enabled": {
          "type": "boolean"
        },
        "endings": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "mappings": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "qualification": {
          "type": "object",
          "additionalProperties": true
        }
      }
    },
    "ThankYouScreen": {
      "type": "object",
      "additionalProperties": true,
      "description": "Builder-compatible additional ending screen presentation payload.",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "buttonLabel": {
          "type": "string"
        },
        "buttonUrl": {
          "type": "string"
        },
        "mediaUrl": {
          "type": "string"
        },
        "backgroundImageUrl": {
          "type": "string"
        }
      }
    },
    "WorkflowRule": {
      "type": "object",
      "additionalProperties": true,
      "description": "Builder-compatible workflow rule. Supports step routes, thank-you routes, and workflow variable actions.",
      "required": [
        "id",
        "source"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "source": {
          "type": "object",
          "additionalProperties": true,
          "required": [
            "stepId"
          ],
          "properties": {
            "stepId": {
              "type": "string"
            }
          }
        },
        "conditions": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "thenAction": {
          "type": "object",
          "additionalProperties": true
        },
        "enabled": {
          "type": "boolean"
        },
        "priority": {
          "type": "integer"
        }
      }
    }
  }
}