{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/onplana-com/json-schema/onplana-com-workflow-schema.json",
  "title": "Workflow",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/onplana-com-openapi.json#/components/schemas/Workflow",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "organizationId": {
      "type": "string",
      "format": "uuid"
    },
    "projectId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "null = org-wide; set = scoped to one project."
    },
    "isActive": {
      "type": "boolean"
    },
    "trigger": {
      "type": "object",
      "description": "Event that fires this workflow.",
      "properties": {
        "event": {
          "type": "string",
          "description": "e.g. \"task.created\", \"project.status.changed\", \"intake.submitted\""
        }
      },
      "required": [
        "event"
      ]
    },
    "graph": {
      "type": "object",
      "description": "Directed graph of conditions, actions, approval steps, and delays. See the Workflow Builder UI for the canonical shape."
    },
    "schedule": {
      "type": [
        "object",
        "null"
      ],
      "description": "Cron-style schedule for time-triggered workflows."
    },
    "runCount": {
      "type": "integer"
    },
    "maxRuns": {
      "type": [
        "integer",
        "null"
      ]
    },
    "lastRunAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "createdById": {
      "type": "string",
      "format": "uuid"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "name",
    "organizationId",
    "isActive",
    "trigger",
    "graph",
    "createdAt"
  ]
}