{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/groundmail-dev/json-schema/groundmail-dev-trigger-event-response-schema.json",
  "title": "TriggerEventResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/groundmail-dev-events-api-openapi.yml#/components/schemas/TriggerEventResponse",
  "type": "object",
  "required": [
    "event",
    "matched_automations",
    "resumed_runs",
    "cancelled_runs"
  ],
  "properties": {
    "event": {
      "$ref": "#/$defs/EventRecord"
    },
    "matched_automations": {
      "type": "integer"
    },
    "resumed_runs": {
      "type": "integer"
    },
    "cancelled_runs": {
      "type": "integer",
      "description": "Active runs cancelled because this event matched `trigger.cancel_on_events`"
    },
    "skipped_enrollments": {
      "type": "integer",
      "description": "Automations whose trigger matched but did not start a run, because of `trigger.once_per_contact` or `trigger.cooldown_days`"
    },
    "enrollment_skips": {
      "type": "array",
      "description": "Present when `skipped_enrollments` is above zero. One entry per automation that declined to enrol this recipient again.",
      "items": {
        "type": "object",
        "required": [
          "automation_id",
          "reason",
          "prior_run_id",
          "prior_run_at"
        ],
        "properties": {
          "automation_id": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "once_per_contact",
              "cooldown"
            ]
          },
          "prior_run_id": {
            "type": "string"
          },
          "prior_run_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    }
  },
  "$defs": {
    "EventRecord": {
      "type": "object",
      "required": [
        "id",
        "name",
        "user_id",
        "email",
        "data",
        "source",
        "created_at"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "user_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "format": "email"
        },
        "data": {
          "type": "object",
          "additionalProperties": true
        },
        "source": {
          "type": "string",
          "enum": [
            "api",
            "dashboard"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}