{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/breakreach-com/json-schema/breakreach-com-dm-automation-run-schema.json",
  "title": "DmAutomationRun",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/breakreach-com-openapi.json#/components/schemas/DmAutomationRun",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "automationId": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "running",
        "waiting",
        "completed",
        "handed_off",
        "stopped",
        "window_closed",
        "failed"
      ]
    },
    "contact": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Instagram-scoped or Page-scoped id"
        },
        "username": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "trigger": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        },
        "text": {
          "type": [
            "string",
            "null"
          ]
        },
        "ref": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "stepId": {
      "type": [
        "string",
        "null"
      ]
    },
    "waiting": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "timer",
            "choice",
            "reply",
            "click"
          ]
        },
        "stepId": {
          "type": "string"
        },
        "until": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "clicks": {
      "type": "integer"
    },
    "log": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "description": "trigger, sent, choice, reply, click, branch, wait, waited, handoff, end, error"
          },
          "stepId": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "detail": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "endReason": {
      "type": [
        "string",
        "null"
      ],
      "description": "done, handoff, human_replied (someone answered by hand), window (Meta's 24-hour window closed), paused, deleted, flow_changed, stopped_by_team, send, account"
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "endedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  }
}