{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fnlowl-com/json-schema/fnlowl-com-sequence-draft-schema.json",
  "title": "SequenceDraft",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fnlowl-com-sequences-api-openapi.yml#/components/schemas/SequenceDraft",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "draft"
      ]
    },
    "widgetId": {
      "type": [
        "string",
        "null"
      ]
    },
    "steps": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "email"
                ]
              },
              "subject": {
                "type": "string"
              },
              "body": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "type",
              "subject",
              "body"
            ]
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "delay"
                ]
              },
              "delayDays": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "id",
              "type",
              "delayDays"
            ]
          }
        ]
      }
    },
    "branch": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "filters": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "field": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "unsubscribed",
                  "quizTierLabel"
                ]
              },
              "equals": {
                "type": "string"
              },
              "steps": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "email"
                          ]
                        },
                        "subject": {
                          "type": "string"
                        },
                        "body": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "subject",
                        "body"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "delay"
                          ]
                        },
                        "delayDays": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "delayDays"
                      ]
                    }
                  ]
                }
              }
            },
            "required": [
              "id",
              "field",
              "equals",
              "steps"
            ]
          }
        }
      },
      "required": [
        "filters"
      ]
    }
  },
  "required": [
    "name",
    "status",
    "widgetId",
    "steps",
    "branch"
  ]
}